If I do the following: for item in block:
where block is a file, then item becomes each line of the file in turn But if block in a large string (let's say the actual text that was in the file), item becomes each character at a time. Is there a way to have a uniform iteration irrespective of whether block is a file or string (ideally one \n-delimited line at a time)? I'm writing a recursive parser, where text is looked at one line at a time, if a block delimiter is found, the block is isolated and the parser is recursively called on the block. I would like to start it off on a file and then each block would be a large string, but the default for behavior is being problematic. I could turn the whole file into a string first, but that might cause problems with large files. Any alternate solutions would be appreciated as well. Thanks, Basu -- The ByteBaker : http://www.bytebaker.com _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
