-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Kent,
Sorry for causing so much trouble. I am not married to either a single or multi-line solution one way or another. Just a solution that works. Based on something by Danny Yoo provided, I had started with something like: import re,base64 # Evaluate captured character as hex def ret_hex(value): return base64.b16encode(value) def ret_ascii(value): return base64.b16decode(value) # Evaluate the value of whatever was matched def eval_match(match): return ret_ascii(match.group(0)) out=open(r'e:\pycode\sigh.new2','wb') # Read each line, pass any matches on line to function for # line in file.readlines(): for line in open(r'e:\pycode\sigh.new','rb'): print (re.sub('[^\w\s]',eval_match, line)) The char to hex pass works but omits the leading x. The hex to char pass does not appear to work at all. No error is generated. It just appears to be ignored. Kent Johnson wrote: > Andrew Robert wrote: <snip> </snip> > > You have an argument in the wrong place. Stop trying to do everything in > one line! Put the lambda in a def'd function. Put the re.sub on it's own > line. You are tripping over unnecessary complexity. I'm not going to fix > it any more. > > Kent > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > - -- Thank you, Andrew Robert Systems Architect Information Technologies MFS Investment Management Phone: 617-954-5882 E-mail: [EMAIL PROTECTED] Linux User Number: #201204 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (MingW32) iD8DBQFEddHSDvn/4H0LjDwRAibnAJ4/6/IiPtz7k+jIa01kRe1X25UNkACfaq24 bbqKqyOZyLpCRBEHbrO7H7A= =8+rq -----END PGP SIGNATURE----- _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor