How to break a sentence in python depending on fullstop '.'?
<p>I writing a script in python in which I have the following string:</p>

<pre><code>a = "write This is mango. write This is orange."
</code></pre>

<p>I want to break this string into sentences and then add each sentence as an item of a list so it becomes:</p>

<pre><code>list = ['write This is mango.', 'write This is orange.']
</code></pre>

<p>I have tried using TextBlob but it is not reading it correctly.(Reads the whole string as one sentence).</p>

<p>Is there a simple way of doing it?</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;code&gt;a.split()&lt;/code&gt;</code></pre>
</div>
</div>
</p>

<p>a.split() seems like a simple way of doing it, but you will eventually run into problems. </p>

<p>For example suppose you have</p>

<pre><code>a = 'What is the price of the orange? \
It costs $1.39. \
Thank you! \
See you soon Mr. Meowgi.' 
</code></pre>

<p>The a.split('.') would return: </p>

<pre><code>a[0] = 'What is the price of the orange? It costs $1'
a[1] = '39'
a[2] = 'Thank you! See you soon Mr'
a[3] = 'Meowgi'
</code></pre>

<p>I am also not factoring in </p>

<ul>
<li>code snippets 

<ul>
<li>e.g. 'The problem occured when I ran ./sen_split function. "a.str(" did not have a closing bracket.'</li>
</ul></li>
<li>Possible Names of Company's 

<ul>
<li>e.g. 'I work for the Node.js company'</li>
</ul></li>
<li>etc.</li>
</ul>

<p>This eventually boils down to English syntax. I would recommend looking into nltk module as Mike Tung pointed out.</p>

python list