string.digits, string.letters? How?

Sean 'Shaleh' Perry shalehperry at home.com
Wed Oct 17 12:23:41 EDT 2001


On 17-Oct-2001 Paul Lim wrote:
> How can we use the digits, letters variable in the string modules?

open string.py and you will see a line like:

digits = '0123456789'

This creates a string assigned to the variable 'digits'.

>>> import string
>>> s = '1'
>>> s in string.digits
1
>>> s in string.letters
0
>>> l = 'A'
>>> l in string.letters
1

-----
We have buried the putrid corpse of Liberty. -- Benito Mussolini




More information about the Python-list mailing list