Tim Chase wrote: > > I have a list AAA = [1, 2, 3] and would like to subtract one from list > > AAA > > so AAA' = [0, 1, 2] > > > > What should I do? > > > Sounds like a list comprehension to me:
Also the built in function 'map' would work: >>> a = [1,2,3] >>> b = map(lambda x: x-1, a) >>> b [0, 1, 2] List comprehensions are more pythonic, but map would probably be faster if performance was a (real) issue. -- http://mail.python.org/mailman/listinfo/python-list