摘要:Problem:如题Solution:一个简单的工厂类方法:import stringdef translator(frm='', to='', delete='', keep=None) if len(to)=1: to = to * len(frm) trans = string.maketrans(frm, to) if keep is not None: allchars = string...
阅读全文
06 2010 档案
摘要:Problem:检查字符串中是否存在某些字符的集合Solution:下面的方法可以用在任何的序列容器中def containsAny(seq, aset): """ Check whether sequence seq contains ANY of the items in aset. """ for c in seq: if c in aset: return True return Fals...
阅读全文
摘要:# -*- coding:utf-8 -*-"""Created on 2010-5-21单链表的实现 1@author: Administrator"""class LinkedList(object): class Element(object): ''' 定义元素,包含了数据内容_datum和指向下一元素的链接_next ''' def __init__(self,list,datum...
阅读全文
浙公网安备 33010602011771号