2012年9月22日
摘要: 用过python的朋友应该知道,python的string中有个replace函数,其功能是实现字符串的替换,默认情况下是替换所有,如果加入参数的话会根据设定的个数进行替换,比如下面的例子:>>> import string>>> str1 = "ab1ab2ab3ab4">>> print string.replace(str1,"ab","cd")cd1cd2cd3cd4>>> print string.replace(str1,"ab", 阅读全文
posted @ 2012-09-22 22:44 Mike_Zhang 阅读(7802) 评论(9) 推荐(1)