ReXX Style translate() function for strings ?

Greg Ewing greg at
Wed Oct 31 05:16:34 CET 2001

P Adhia wrote:
> new_date = Translate('56/78/1234', old_date, '12345678')

import string

def Translate(outpict, input, inpict):
  return string.translate(outpict, string.maketrans(inpict, input))

Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:

More information about the Python-list mailing list