<分区> 分区>
处理完来自 stdin 的值后,我在 python 程序中得到了以下列表:
[['92', '022'], ['82', '12'], ['77', '13']]
我试图将值设置为:
[[92, 22], [82, 12], [77, 13]]
我已尝试映射值但发现错误:
print map(int, s)
Traceback (most recent call last):
File "C:/Users/lenovo-pc/PycharmProjects/untitled11/order string.py", line 13, in <module>
print map(int, s)
TypeError: int() argument must be a string or a number, not 'list'
s 是我的列表。
请建议我将 str 列表转换为整数的优化方法是什么。
