[Tutor] string.unprintable?

Clay Shirky clay at ernie.webservepro.com
Fri Nov 21 10:04:17 EST 2003

I want to loop over a file with some printable and some binary lines,
printing the former.

What I really want is

for line in file("spam"):
    if string.unprintable in line:
    print line

but there is no string.unprintable, and

if not string.printable in line

for some reason matches everything in the file, even though I've .strip()ed
the line aready.


More information about the Tutor mailing list