Python Cookbook学习记录 ch1_10_2013/10/23
摘要:
1.10 过滤字符串中不属于指定集合的字符这个函数的实现方法和上一节一样:"除去要保留的剩下的都是要删除的">>> import string>>> allchars = string.maketrans('','')>>> def makefilter(keep): delchars = allchars.translate(allchars,keep) def thefilters(s): return s.translate(allchars,delchars) return the 阅读全文
posted @ 2013-10-23 22:50 七海之风 阅读(112) 评论(0) 推荐(0)
浙公网安备 33010602011771号