[Tutor] just what does read() return?

Steve Willoughby steve at alchemy.com
Fri Oct 1 00:55:39 CEST 2010


On 30-Sep-10 15:49, Alex Hall wrote:
> re.split(r"\n+", self.original)
> That did it, and my program once again runs as expected. Thanks!

If you don't need blank lines stripped out (r'\n+' considers multiple 
consecutive \n characters to be a single record separator), you can 
avoid the regex and just use the normal string split:

list_of_lines = giant_string.split('\n')


More information about the Tutor mailing list