python二维数组如何转换类型
[['1', '255']][['256', '509'], ['510', '763'], ['764', '1017'], ['1018', '1271'], ['1272', '1526']]
如何转换成
===>
[[1, 255]][[256, 509], [510, 763], [764, 1017], [1018, 1271], [1272, 1526]]
下面的代码直接报错
data = [['1', '255']][['256', '509'], ['510', '763'], ['764', '1017'], ['1018', '1271'],
['1272', '1526']]
datadata = int(data)
####################
问题自己给解决了,
data = [['256', '509'], ['510', '763'], ['764', '1017'], ['1018', '1271'], ['1272', '1526']]
data = [[int(y) for y in x] for x in data]
[此贴子已经被作者于2020-12-4 13:35编辑过]