0
A
回答
4
lines = fulltext.splitlines()
處理\r
,\n
及其組合(也對其他操作系統的工作原理):
>>> 'a\rb\nc\r\nd'.splitlines()
['a', 'b', 'c', 'd']
1
for line in fulltext.split('\n'):
# do something with the line
+0
greatethanks很多! – Nigiri 2012-02-16 09:01:57
0
有點不清楚,但是這是你在找什麼?
string = """line one
line two
line three"""
lines = string.split('\n')
+0
感謝您的支持! – Nigiri 2012-02-16 09:03:30
相關問題
- 1. 在Python中一次讀取stdin行
- 2. Python:讀取上一行並與當前行進行比較
- 3. 如何在Python中讀取一行csv數據?
- 4. 如何在Python中讀取一段時間內的行?
- 5. 如何讀取python中最後幾行?
- 6. 如何在Python中一行一行地讀取文件(或stdin)而不是等待讀取整個文件
- 7. 我如何讀取文本文件選擇行與Python
- 8. 如何在Python中讀取行和刪除行?
- 9. 從python的文件中讀取一行
- 10. 讀取非統一行ascii數據 - Python
- 11. Python - 一次從文件讀取1000行
- 12. 如何讀取數組的第一行中的Python
- 13. 如何從python中的一個文件中讀取隨機行?
- 14. OPENXML如何與OpenXmlReader讀取一個inlineStr
- 15. 如何讀取行?
- 16. 如何讀取使用python
- 17. 讀取XML文件與Python
- 18. 讀取數據與Python
- 19. Python的讀取與urllib的
- 20. 如何在Python中讀取CSV文件?
- 21. 如何保存/讀取類全在Python
- 22. 如何在python中讀取/ dev/random
- 23. 如何在Python中循環時讀一行幾行?
- 24. 如何逐行讀取一個僅限CR的文件與Perl?
- 25. 如何讓程序讀取一行? C++
- 26. 如何從stdin讀取一行
- 27. 如何使用C#讀取一行HTML#
- 28. AsyncSocket與讀取行爲不一致
- 29. 逐行讀取.txt文件一行在Python
- 30. Python/xrld讀取行和列
哎呀。一個換行符被刪除 – Nigiri 2012-02-16 08:48:45