python.split
====================
演示了Python中的字符串通过split分割后的使用和把分割后的字符串连接起来
#!/usr/bin/env python
str = ("i am a worker, and you are a student !")
print str
#split the str,if not specified the separator ,the whitespace is a separator,items is a sequence
items = str.split()
print items
#join the str
sep=":"
items=sep.join(items)
print items
执行这个脚本2.py,得到的结果为:
i am a worker, and you are a student !
['i', 'am', 'a', 'worker,', 'and', 'you', 'are', 'a', 'student', '!']
i:am:a:worker,:and:you:are:a:student:!