Mega Code Archive

 
Categories / Python Tutorial / String
 

Translate replaces parts of a string, translate only works with single characters

from string  import maketrans table = maketrans('cs', 'kz') print 'this is a test'.translate(table)