摘要:
class LoopError(Exception):passrs = ''try: for i in range(1, 3): print i rs = 'one ' if i == 1: for j in range(12, 22): print j if j == 13: rs = 'bbs' raise LoopErrorexcept LoopError: #跳出,遇到LoopErr... 阅读全文
摘要:
l = map(chr, xrange(256)) #将ascii转为字符串_idmap = str('').join(l)del l# Construct a translation string_idmapL = None #定义一个全局变量def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.trans 阅读全文
摘要:
def capwords(s, sep=None): """capwords(s [,sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. If the optional second argument sep is absent or None, runs of whitespace characters are replaced 阅读全文