how to search new line character from a string in python
<p>I want to split string based on new line character and replace the new line with a '.' in python. I tried this code but I'm not getting it.</p>

<pre><code>import nltk
from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktParameters, PunktLanguageVars
ex_sent="Conclusion &amp; Future Work
     In our project we have tried for implementing northbound SDN application for OpenFlow protocol evaluation. The client and the RYU application is being connected, via socket connection."
class CommaPoint(PunktLanguageVars):
    sent_end_chars = (',','\n')
tokenizer = PunktSentenceTokenizer(lang_vars = CommaPoint())
sentences = sentence_splitter.tokenize(ex_sent)
print sentences
</code></pre>

<p>The newline character is <code>\n</code>. So If you want to replace all new line characters in string with <code>.</code> you should use <code>replace()</code> method. In this case:</p>

<pre><code>your_string.replace('\n', '.')
</code></pre>

<p>A second approach is to <code>.split('\n')</code> by newline and then <code>'.'.join(your_string)</code>. You should checkout the <a href="https://docs.python.org/3/library/stdtypes.html" rel="nofollow">Python documentation.</a></p>

python nltk