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