>", line 1, in
File "", line 3, in my_abs
TypeError: bad operand type#错误的参数类型
返回多个值
Python...'z', 'END']
>>> add_end()
['END']
>>> add_end()
['END', 'END']
>>> add_end()
['END', 'END', 'END']
Python...>>> d = {'a': 1, 'b': 2, 'c': 3}
>>> for key in d:3只要是可迭代对象,无论有无下标,都可以迭代,比如dict
......print x, y
...
1 1
2 4
3 9
列表生成式ListComprehensions
>>> range(1, 11)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>...>>> L = [x * x for x inrange(10)]#列表生成式的[]改成(),就创建了一个generator
>>> L
[0, 1, 4, 9, 16, 25, 36, 49, 64,