> 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
Thanks for your suggestions, I've decided to go with the smart
iterator solution, it's given me the results that I need. The
generator solution also seems interesting and I might try it out at a
later point.
--
The ByteBaker :
http://www.bytebaker.com
___
"Shrutarshi Basu" <[EMAIL PROTECTED]> wrote
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.
Correct because for iterates over a
On Mon, Jun 9, 2008 at 5:26 PM, Shrutarshi Basu <[EMAIL PROTECTED]> wrote:
> 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 eac
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 wheth