Or, using list comprehension.
>>> numbers = [1, 2, 3, 4, 5]
>>> numbers = [n + 5 for n in numbers]
>>> numbers
[6, 7, 8, 9, 10]
--
http://mail.python.org/mailman/listinfo/python-list
;, 'blue', 'green', 'yellow']
>>>
Here is the link to a discussion of the build-in str methods (3.2), but this
documentation exists for prior versions of Python as well.
http://docs.python.org/py3k/library/stdtypes.html#str.split
Good luck,
Mark Niemczyk
--
http://mail.python.org/mailman/listinfo/python-list
Some interesting performance comparisons, under Python 3.2. Times are
relative, and are for an initial list of tuples with 500,000 items.
(1)ans = []
#relative time: 298
for item in lst:
ans += list(item
As of Python 3.x (which I suspect you are running):
"The objects returned by dict.keys(), dict.values() and dict.items() are view
objects. They provide a dynamic view on the dictionary’s entries, which means
that when the dictionary changes, the view reflects these changes.", and
"Iterating vi