Hack Forums
[Python] How to convert each file rung to an item in a list? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] How to convert each file rung to an item in a list? (/showthread.php?tid=5969753)



How to convert each file rung to an item in a list? - Avispon99 - May 13, 2019

Hi. I need the program to read a text document every time I find a jump line (\ n), convert the text read before the line break into an element of a list.

With the function "split" does not work because it converts each word into a list item and that's not what I need, I need each row to be a list item.

Does anyone know any method or regular expression to do it?