python中使用join连接list时出现类型错误的解决办法 例: >>> ls = [1,2,3] >>> print ','.join(ls) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: sequence item 0: expected string, int found 解决办法对list中的元素进行类型转换到string >>> print ','.join('%s' % id for id in ls) 1,2,3
ref : http://hi.baidu.com/zhumq92/item/3e58dd395c4b040dcfb9fe62