How to strip line breaks from BeautifulSoup get text method
<p>I have a following output after scraping a web page</p>

<pre><code>       text
Out[50]: 
['\nAbsolute FreeBSD, 2nd Edition\n',
'\nAbsolute OpenBSD, 2nd Edition\n',
'\nAndroid Security Internals\n',
'\nApple Confidential 2.0\n',
'\nArduino Playground\n',
'\nArduino Project Handbook\n',
'\nArduino Workshop\n',
'\nArt of Assembly Language, 2nd Edition\n',
'\nArt of Debugging\n',
'\nArt of Interactive Design\n',]
</code></pre>

<p>I need to strip \n from above list while iterating over it. Following is my code</p>

<pre><code>text = []
for name in web_text:
   a = name.get_text()
   text.append(a)
</code></pre>

<p>Rather than calling <code>.strip()</code> explicitly, use the <code>strip</code> argument:</p>

<pre><code>a = name.get_text(strip=True)
</code></pre>

<p>This would also remove the extra whitespace and newline characters in the children texts if any.</p>

python beautifulsoup