#coding:utf8
list=[' sfsfsf','ADFFDS','adas dasd']
#将列表字符串合并
str="".join(list)
print str
#去掉开头空格
str=str.strip()
print str
#去掉中间空格
str=str.replace(" ","")
print str
#将列表中字符串合并,连接处用字符‘+’连接
str2="+".join(list)
print str2
#将一段字符切割
str3='adas-asdfada-dad-ada-a-dadaa-aa'
str4=str3.split('-')
print str4
输出结果
C:\Python27\python.exe C:/Users/gf/Desktop/python草稿测试/列表字符串合并去空格.py
sfsfsfADFFDSadas dasd
sfsfsfADFFDSadas dasd
sfsfsfADFFDSadasdasd
sfsfsf+ADFFDS+adas dasd
['adas', 'asdfada', 'dad', 'ada', 'a', 'dadaa', 'aa']
Process finished with exit code 0