How do i match just spaces and newlines with Python regex?

PythonServer Side ProgrammingProgramming

<p style="">The following matches and prints just spaces and newlines in the given string using Python regex</p><h2 style="">Example</h2><pre class="prettyprint notranslate">import re foo = &#39; I find &nbsp; Tutorialspoint &nbsp; useful&#39; result = re.findall(r&#39;\s+&#39;, foo) print result</pre><h2 style="">Output</h2><p>This gives the output</p><pre class="result notranslate">[&#39; &#39;, &#39; &#39;, &#39; &#39;, &#39; &#39;]</pre>
raja
Updated on 19-Feb-2020 12:42:18

Advertisements