> 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?

I ended up doing this, but please reply if you have a more elegant solution:

if line.startswith('notes'):
   break
notes = open('myfile','r').read().split(notes:\n')[1]
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to