Thanks
> To: tutor@python.org
> From: breamore...@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 a
On 01/05/2014 06:21, Scott W Dunning wrote:
Hello, I am new to python and have a final review coming up and was hoping you
could help me answer a few questions I came across while studying.
So, I get a little confused about lists sometimes. This one is a little hard
to make heads or tails of.
Ian D, 01.05.2014 16:38:
> I have this part of code and am unsure as to the effect of the array('c')
> part.
The argument that you pass into the constructor is a type identifier.
https://docs.python.org/2/library/array.html#array.array
The different types are defined at the top of that page.
I
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))
Ian D wrote:
> 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?
No, the first arg to array.array() is the typecode; data may be passed as
the second argument. The typecode "c" creates an array of 8-bit ch
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) & 0
On Wed, Apr 30, 2014 at 10:21:41PM -0700, Scott W Dunning wrote:
> So, I get a little confused about lists sometimes. This one is a
> little hard to make heads or tails of. I get confused about how to
> tell how many lists are within one list like the one below. How many
> lists are located
Ian D Wrote in message:
> Can anyone clarify please?
>
>
> Just reading this:
>
> https://wiki.python.org/moin/BitwiseOperators
>
>
> The section on 2's complement binary for negative integers.
>
>
> It states:
>
>
> "Thus the number -5 is treated by bitwise operators as if it were writte
Ian D wrote:
> Can anyone clarify please?
>
>
> Just reading this:
> https://wiki.python.org/moin/BitwiseOperators
> The section on 2's complement binary for negative integers.
> It states:
> "Thus the number -5 is treated by bitwise operators as if it were written
> "...11101
Ian D wrote:
> I am trying to follow some code. It is basically a python scratch
> interfacing script.
> Anyway part of the script has this code.
> Searching google for >> greater than signs in code with python has its
> issues.
> Can anyone clarify this stuff.
> I know its about 4 bytes of data.
On Thu, May 1, 2014 at 7:21 AM, Scott W Dunning wrote:
> Hello, I am new to python and have a final review coming up and was hoping
> you could help me answer a few questions I came across while studying.
>
>
> So, I get a little confused about lists sometimes. This one is a little hard
> to ma
But what is the purpose of ANDing with 255?
Would this not just return the same value?
eg 1010 and with would just return 1010 or 1010
> From: dux...@hotmail.com
> To: tutor@python.org
> Date: Thu, 1 May 2014 09:53:15 +
> Subject: Re
Ok I am getting somewhere with this now.
A bitshift followed by ANDing the result of the shift!
So I think n>> 24 & 0xFF
is
shift n 3 bytes right, save results in n and then AND n with 255 decimal?
> From: dux...@hotmail.com
> To: tutor@python.org
Can anyone clarify please?
Just reading this:
https://wiki.python.org/moin/BitwiseOperators
The section on 2's complement binary for negative integers.
It states:
"Thus the number -5 is treated by bitwise operators as if it were written
"...111011". "
I am wondering why
Hello, I am new to python and have a final review coming up and was hoping you
could help me answer a few questions I came across while studying.
So, I get a little confused about lists sometimes. This one is a little hard
to make heads or tails of. I get confused about how to tell how many l
I am trying to follow some code. It is basically a python scratch interfacing
script.
Anyway part of the script has this code.
Searching google for >> greater than signs in code with python has its issues.
Can anyone clarify this stuff.
I know its about 4 bytes of data. It looks like
16 matches
Mail list logo