readlines() reading incorrect number of lines?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Dec 27 05:27:49 EST 2007


En Fri, 21 Dec 2007 16:42:21 -0300, Gerry <gerard.blais at gmail.com>  
escribió:

> whitespace      = ' \t\n\r\v\f'
> lowercase       = 'abcdefghijklmnopqrstuvwxyz'
> uppercase       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
> letters         = lowercase + uppercase
> ascii_lowercase = lowercase
> ascii_uppercase = uppercase
> ascii_letters   = ascii_lowercase + ascii_uppercase
> digits          = '0123456789'
> hexdigits       = digits + 'abcdef' + 'ABCDEF'
> octdigits       = '01234567'
> punctuation     = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
> printable       = digits + letters + punctuation

You do know that most -if not all- of those sets are available as  
attributes of the string module, don't you?
You could replace all the lines above with: from string import printable,  
as it's the only constant used.

-- 
Gabriel Genellina




More information about the Python-list mailing list