Aug 022009

If you don’t want to refer to the elements of a collection by their position number but prefer some other type of object as a key,
use a python dictionary
———–
e.g.,
>>> tel = {’jack’: 4098, ’sape’: 4139}
>>> tel['guido'] = 4127
>>> tel
{’sape’: 4139, ‘guido’: 4127, ‘jack’: 4098}
>>> tel['jack']
4098
>>> del tel['sape']
>>> tel['irv'] = 4127
>>> tel
{’guido’: 4127, ‘irv’: 4127, ‘jack’: [...]

Posted by weboom at 7:18 pm Tagged with: , , ,
Jul 252009

use brackets
e.g.,
request.GET['q']

Posted by weboom at 1:00 pm Tagged with: ,
Switch to our mobile site
Top Footer