[Tutor] Extract lines from a multinile string
Eli Brosh
ebrosh at nana10.co.il
Wed Oct 10 06:23:59 CEST 2007
Hello
I have a multiline string such as:
s='''This is the first line
This is the second line
This is the third longer line'''
Note that s has no control character such as \n.
The lines are defined as in "natural" writing.
How can I extract from s, several strings, each of which is a line from the original string ?
s1='This is the first line'
s2='This is the second line'
s3='This is the third longer line'
Suppose this can be done using some kind of loop,
How can I know that I extracted the last line in the string ?
Thanks
Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071010/9122d513/attachment.htm
More information about the Tutor
mailing list