struct is saving 4 bytes instead of 2
TonyB
tigerb at yahoo.com
Wed Sep 12 17:23:37 EDT 2007
More information about the Python-list mailing list
Wed Sep 12 17:23:37 EDT 2007
- Previous message (by thread): struct is saving 4 bytes instead of 2
- Next message (by thread): struct is saving 4 bytes instead of 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Using UBUNTU python 2.4.3 I'm using struct to save a variable to a
file. My goal is to save it as a 2 byte signed integer. Its being
saved using:
f.write(struct.pack('h',thevariable))
When I inspect the file with a hex editor it show that the variable is
being saved as 4 bytes. How can I make it save the value as 2 bytes?
Tony
- Previous message (by thread): struct is saving 4 bytes instead of 2
- Next message (by thread): struct is saving 4 bytes instead of 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list