【发布时间】:2013-09-01 19:21:45
【问题描述】:
我的程序要求用户输入 10 个我正在使用此代码的随机数。
numbers = input("Type 10 numbers, separeted by spaces: ")
numberlist = list(numbers)
numberlist = map(int,numberlist)
print(numberlist)
但是当程序编译时,我可以输入 10 个数字,但我在 shell 中收到了这条消息。
<map object at 0xb51a11cc>
任何人都知道解决方案是什么?我在 ubuntu 13.04 中使用 python 3.3。
谢谢。
【问题讨论】:
-
list(map(int,numberlist)),使用list()。请注意,list(numbers)不会做你认为它会做的事情,请使用:numbers.split()。
标签: python list map int python-3.3