Show '\011', '\012', and '\015' as '\t', '\n', '\r' in strings.

Switch from octal escapes to hex escapes for other nonprintable characters.
This commit is contained in:
Ka-Ping Yee 2001-01-24 17:19:08 +00:00
parent 726b78ecb8
commit fa004ad36c
13 changed files with 221 additions and 205 deletions

View file

@ -168,8 +168,8 @@ big-endian machine):
\begin{verbatim}
>>> from struct import *
>>> pack('hhl', 1, 2, 3)
'\000\001\000\002\000\000\000\003'
>>> unpack('hhl', '\000\001\000\002\000\000\000\003')
'\x00\x01\x00\x02\x00\x00\x00\x03'
>>> unpack('hhl', '\x00\x01\x00\x02\x00\x00\x00\x03')
(1, 2, 3)
>>> calcsize('hhl')
8