[Tutor] Import multiple lines of text into a variable

Sean Carolan scarolan at gmail.com
Tue Apr 12 03:27:29 CEST 2011


>> if line.startswith('notes'):
>>   break
>> notes = open('myfile','r').read().split(notes:\n')[1]
>
> The first two lines are redundant you only need the last one.

I should have clarified, the "if line.startswith" part was used to
break out of the previous for loop, which was used to import the
other, shorter strings.


More information about the Tutor mailing list