sorry for this stupid question about struct module
chris.gonnerman at newcenturycomputers.net
Fri Sep 20 14:12:19 CEST 2002
----- Original Message -----
From: "Alex Martelli" <aleax at aleax.it>
> Alan Marchand wrote:
> > Hi all,
> > I tryed this :
> > e:\temp>python.exe
> > Python 2.2.1 ( #34, Apr 9 2002, ...................)
> > ...........
> >>>> import struct
> >>>> x = struct.pack( '>I', 10 )
> >>>> print repr( x )
> > '\x00\x00\x00\n' # why not !
> > How can I obtain the result a expect : '\x00\x00\x00\0A' ?
<< hacked out lucid explanation of repr >>
> -- but why is repr's
> behavior problematic to you?
It isn't, I'd wager. I suspect Mr. Marchand doesn't realize
that '\n' == '\0x0A'. His entire original post indicated that
he needed that exact value to send to a printer, which is what
makes me suspect he didn't know he actually *had* that value.
I also suspect he does know by now.
Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
More information about the Python-list