I need to know the number of bytes in a \'word\' in Python. The reason I need this is I have the number of words I need to read from a file; if I knew the number of bytes in
How about something like this:
def machine_word_size(): import sys num_bytes = 0 maxint = sys.maxint while maxint > 0: maxint = maxint >> 8 num_bytes += 1 return num_bytes