>>> ‘+‘.join(seq)
>>> ‘This is a test‘.replace(‘is‘, ‘ezz‘)
>>> from string import maketrans >>> table = maketrans(‘cs‘, ‘kz‘)
创建这个表以后,可以将它作为translate方法的参数
>>> ‘this is an incredible test‘.translate(table)
原文:http://www.cnblogs.com/hellosnow/p/7865201.html