On 01/05/2014 15:38, Ian D wrote:
Hi
I have this part of code and am unsure as to the effect of the array('c') part.
Is it creating an array and adding 'c' as its first value?
This does not seem to be the case.
Thanks
n = len(cmd)
a = array('c')
a.append(chr((n>> 24) & 0xFF))
a.append(chr((n>> 16) & 0xFF))
a.append(chr((n>> 8) & 0xFF))
a.append(chr(n & 0xFF))
scratchSock.send(a.tostring() + cmd)
The 'c' is actually a type code see
https://docs.python.org/2/library/array.html#module-array but note that
this does *NOT* exist in Python 3.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor