ds4ff1z wrote: > Hello, i'm looking to find and replace multiple characters in a text > file (test1). I have a bunch of random numbers and i want to replace > each number with a letter (such as replace a 7 with an f and 6 with a > d). I would like a suggestion on an a way to do this. Thanks
how about: >>> import string >>> text1 = "foo bar 12 spam joe876" >>> table = string.maketrans("0123456789","uydnwkdfpx") >>> text1.translate(table) 'foo bar yd spam joepfd' Mark Peters -- http://mail.python.org/mailman/listinfo/python-list