Mega Code Archive

 
Categories / Python Tutorial / String
 

An optional second argument can be supplied to translate, specifying letters that should be deleted

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