Python string replace 方法

Python string replace   方法

 

方法1:

>>> a='...fuck...the....world............'
>>> b=a.replace('.',' ')
>>> print b
   fuck   the    world

方法2:

>>> a='...fuck...the....world............'
>>> b=string.replace(a,'.',' ')
>>> print b
   fuck   the    world 

 

posted @ 2015-01-21 16:54  卡尔西  阅读(396)  评论(0编辑  收藏  举报
AmazingCounters.com