python数组和字符串互相转换

字符串转数组
str = '1,2,3'
arr = str.split(',')

数组转字符串
arr = ['a','b']
str = ','.join(arr)

arr = [1,2,3]
str = ','.join(str(i) for i in b)

转载于:https://www.cnblogs.com/jieliu8080/p/11007507.html

你可能感兴趣的:(python数组和字符串互相转换)