I'm not sure how to do this. I'm reading lines in from a text file. When I reach the string "notes:", I want to assign the remainder of the text file to a single variable (line breaks and all):
text moretext moretext notes: This is the stuff I want in my variable. And this line should be included too. Also this one. So right now my code looks something like this: for line in open('myfile','r'): if line.startswith('notes'): ## Assign rest of file to variable Is there an easy way to do this? Or do I need to read the entire file as a string first and carve it up from there instead? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor