setting variables from a tuple NEWB

nate n8pease at yahoo.com
Thu Jul 6 11:58:42 EDT 2006


manstey wrote:
> Hi,
>
> If I have a tuple like this:
>
> tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh'))
>
> is it possible to write code using tupGlob that is equivalent to:
> VOWELS = 'aeiou'
> CONS = ''bcdfgh'

could you use a dictionary instead? i.e.
>>> tupGlob = {'VOWELS':'aeiou', 'CONS':'bcdfgh'}
>>> tupGlob['VOWELS']
'aeiou'
>>> tupGlob['VOWELS'] = 'aeiou AndSometimesY'
>>> tupGlob['VOWELS']
'aeiou AndSometimesY'

nate




More information about the Python-list mailing list