> What does it mean when you write the [0] after the return statement?
> e.g. return struct.unpack("!h", bytes)[0]

Its just indexing the list returned by struct.unpack(),
specifically extracting tghe first element.

For more on using struct() see the bottom section of my file handling
topic... (now corrected to fix a bug reported by a recent
reader...)

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld 

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to