No sure if appropriate to ask this questions here, since I am a complete noob in Python. I am following the instruction on Gray Hat Python and was working on union coding.
this is the original code
from ctypes import *
class barley_amount(Union):
_fields_ = [
("barley_long", c_long),
("barley_int", c_int),
("barley_char", c_char * 8),
]
value = raw_input("Enter the amount of barley to put into the beer vat: 66")
my_barley = barley_amount(int(value))
print "Barley amount as a long: %ld" % my_barley.barley_long
print "Barley amount as an int: %d" % my_barley.barley_long
print "Barley amount as a char: %s" % my_barley.barley_char
according to Mr. Seitz, the output of this script would be
Enter the amount of barley to put into the beer vat: 66
Barley amount as a long: 66
Barley amount as an int: 66
Barley amount as a char: B
and this is what my results from Eclipse looks like
Finding files... done.
Importing test modules ... Enter the amount of barley to put into the beer vat: 66
can anyone tell me where I did wrong, or what am I missing? Mr. Seitz's book was written in 2009, and his examples only include window and linux, is there any good intro to python for beginner? for mac users?
Very much appreciate Jim