Uses of a deprecated module 'string'

Thomas Jollans thomas at jollans.com
Tue Jun 22 17:37:55 EDT 2010


On 06/22/2010 11:11 PM, Steven Howe wrote:
> Hi, I'm trying to import 'letters' from the string module.
> I get the following message:
> 
>     Uses of a deprecated module 'string'
> 
> I realize the functionality of 'string' is now in the _builtin_. But are
> the
> constants. If so, what are they called. I tried 'letters', but got:
> 
>     NameError: name 'letters' is not defined
> 

>>> import string
>>> from pprint import pprint
>>> pprint(dir(string))
['Formatter',
 'Template',
 '_TemplateMetaclass',
 '__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '_multimap',
 '_re',
 'ascii_letters',
 'ascii_lowercase',
 'ascii_uppercase',
 'capwords',
 'digits',
 'hexdigits',
 'maketrans',
 'octdigits',
 'printable',
 'punctuation',
 'whitespace']
>>>

Looks like `letters' has been renamed to `ascii_letters'.



More information about the Python-list mailing list