A 'raw' codec for binary "strings" in Python?

Gerrit gerrit at nl.linux.org
Mon Mar 1 16:21:57 EST 2004


Bill Janssen wrote:
> print string.join([(((ord(x) > 0 and ord(x) < 0x7F) and x) or (r"\x%02x" % ord(x))) for x in line], '')

How about something like print repr(line)?

Gerrit.

-- 
Weather in Twenthe, Netherlands 01/03 20:25 UTC:
	3.0°C   wind 3.6 m/s W (57 m above NAP)
-- 
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/




More information about the Python-list mailing list