> for line in open(r'e:\pycode\out_test.txt','rb') : > output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(), > 16))) % ord(s.group()), line))
Let's add some whitespace. output.write(re.sub(r'([^\w\s])', lambda s: chr( int(s.group(), 16) ) ) % ord(s.group()), line)) I do see at least one too many parens here, so that's something you should look at. But I'd also recommend writing a helper function here. Just because you can do this in one line doesn't mean you have to. *grin* It might be useful to change the lambda back to a helper function. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor