Life is short, you need Python

Python - split and join

复制代码
>>> s="I am fine"
>>> s
'I am fine'
>>> s.split(" ")
[
'I', 'am', 'fine']
>>> sList=s.split(" ")
>>> sList
[
'I', 'am', 'fine']
>>> "%".join(sList)
'I%am%fine'
复制代码

Notes:

1)String is transfered to a List by split method

2)List can be joined a string by join method

posted @   runfox545  阅读(635)  评论(0编辑  收藏  举报
努力加载评论中...
白月黑羽 Python教程 白月黑羽Python
点击右上角即可分享
微信分享提示