1、list转字符串
其中,引号中是字符之间的分割符,如“,”,“;”,“\t”等等
如:
list = [1, 2, 3, 4, 5]
''.join(list) 结果即为:12345
','.join(list) 结果即为:1,2,3,4,5
2、字符串转list
如:
mStr ='192.168.1.1,192.168.1.2,192.168.1.3'
print(mStr.split(","))
['192.168.1.1','192.168.1.2','192.168.1.3']
网友评论