Splitting lines in a file

Simon Foster simon at uggs.demon.co.uk
Sun Jul 7 18:19:43 EDT 2002


On 8 Jul 2002 00:07:47 +0200, Chris Liechti <cliechti at gmx.net> wrote:

>'cause split() drops the empty part at the end:
>>>> '1\n2\n3\n'.split()
>['1', '2', '3']
>>>> '1\n2\n3\n'.split('\n')
>['1', '2', '3', '']
>


I see it, but I don't see why?  What is the explanation for this?  It
seems at odds with the documentation.



More information about the Python-list mailing list