我有刮網頁從BeautifulSoup如何剝離換行符獲取文本方法
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',]
我需要從上面所列內容剝離時\ n迭代之後下一輸出。以下是我的代碼
text = []
for name in web_text:
a = name.get_text()
text.append(a)