[Tutor] Multiple Dimension (array/list/whatever it is are).
George Patterson
george at visp.com.au
Mon May 10 04:33:50 EDT 2004
Hi All.
A could of quick questions:
1. What is the data structure below called? Apart from G :-P Is it an array, a list or something else. The original article was very vague on the commenting. See bottom of email for URL.
G = {'s':{'u':10, 'x':1},
'u':{'v':1, 'x':2},
'v':{'y':4},
'x':{'u':3, 'v':9, 'y':2},
'y':{'s':7, 'v':6}
}
2. How would I alter the above data structure such that all instances of 'x' ends up being equal to 5. As per sample below.
{'s':{'u':10, 'x':5},
'u':{'v':1, 'x':5},
'v':{'y':4},
'x':{'u':3, 'v':9, 'y':2},
'y':{'s':7, 'v':6}
}
For those that want the rest of the code see
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/119466
George Patterson
More information about the Tutor
mailing list