learning with python question (HtTLaPP)

umpsumps at gmail.com umpsumps at gmail.com
Sat Apr 26 18:23:11 EDT 2008


This is what I'm stuck on.  I keep doing things like:

for line in fin:
    for ch in letters:
        if ch not in line:


I've tried

for ch in letters:
    for line in fin:

too..

Should I use a while statement?  What's the best way to compare a
group of letters to a line?


> This would be a more difficult approach..   Where you are doing the
> comparison step:
>
> if letters in line.strip():
>
> It's trying to match the exact string "uzi", not any of the individual
> letters.  You would need to look for each letter independently and
> then make sure they were in the right order to match the other words.




More information about the Python-list mailing list