[Tutor] array('c')
Ian D
duxbuz at hotmail.com
Thu May 1 18:58:59 CEST 2014
Thanks
> To: tutor at python.org
> From: breamoreboy at yahoo.co.uk
> Date: Thu, 1 May 2014 16:40:54 +0100
> Subject: Re: [Tutor] array('c')
>
> 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 at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140501/890f59ff/attachment.html>
More information about the Tutor
mailing list