专注 K8S研究
分类: Python/Ruby
2013-07-07 16:18:34
join:在序列中添加元素
split: 将字符串分解成序列
两者为互逆方法
代码
s = "as, asdas \r\nasda"
print s.split();
# result: ['as,', 'asdas', 'asda']
print "".join(s.split());
# result: as,asdasasda
l = "".join(s.split()).split(',');
print l;
# result: ['as', 'asdasasda']