[Tutor] Letter Frequency Count.

Evgeny Roubinchtein eroubinc@u.washington.edu
Sat, 8 Jan 2000 12:06:03 -0800 (PST)


On Sat, 8 Jan 2000, Doug Stanfield wrote:

[...]
>Where individual should be each single character from the file.  In your
>case this won't work straight off because you've read the whole file in. You
>might need to do the following to get to each character assuming you just
>want to throw away newlines:
>
>for line in emperor:
>      for individual in line:
>            # ... process individual ...
>
[...]

Well,  am confused by this:  I thought the file object's read() method
returns a single string, not a list of strings -- unlike readlines() -- so
what's the need for nested loops?

--
Evgeny 

BOMB: Burn Out Memory Banks