python list去除空值;list和str互相转换
python list去除空值;list和str互相转换
1、new_list = list(filter(lambda x:x!=None,list))
2、 list---->str
list = ['1','2','3']
print("".join(list))
list = [1,2,3]
strlist = [str(x) for x in list]
print("".join(strNums))
str---->list
num = '123'
listnum = list(num)
将list转成字符串,中间用符号分隔
data = [1,2,3,4]
print ",".join(str(i) for i in data)
共有 0 条评论