ReXX Style translate() function for strings ?

Greg Ewing greg at cosc.canterbury.ac.nz
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:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list