为什么这不只是给我“3”,而是仍然是“[3]”?
a = [3]
print "".join(str(a))
请您参考如下方法:
因为你对整个列表调用了to string函数
尝试:
a = [3]
print "".join([str(v) for v in a])
阅读问题标题后,您只是想从列表中获取单个整数,还是想将整数列表转换为“更大”的整数,例如:
a = [3, 2]
print "".join([str(v) for v in a]) ## This gives a string and not integer
>>> "32"
