你确定你的val是长整型?错误提示是说list对象不可调用,说明val是一个list(自己可以print type(val)试试,在str(val)前面).那也就是说明你的是嵌套列表?可以给出更多的数据?
a = {1.1:2,2.2:3}print dict(map(lambda x:(int(x[0]),x[1]) if type(x[0])==float else (x[0],x[1]) , a.items()))
好的