首页 > 代码库 > map(int, ..) 与 int() 的区别

map(int, ..) 与 int() 的区别

>>> map(int,0)[0]>>> int(-1)-1>>> map(int, l[1])Traceback (most recent call last):  File "<stdin>", line 1, in <module>ValueError: invalid literal for int() with base 10: .>>> map(int, -1)Traceback (most recent call last):  File "<stdin>", line 1, in <module>ValueError: invalid literal for int() with base 10: ->>> map(int, 1.0)Traceback (most recent call last):  File "<stdin>", line 1, in <module>ValueError: invalid literal for int() with base 10: .>>> int(1.0)Traceback (most recent call last):  File "<stdin>", line 1, in <module>ValueError: invalid literal for int() with base 10: 1.0>>> map(int, [1.0])Traceback (most recent call last):  File "<stdin>", line 1, in <module>ValueError: invalid literal for int() with base 10: 1.0>>> map(int, [-1])[-1]

 

map(int, ..) 与 int() 的区别