bitwsie operator help please
Samuel Schulenburg
samschul at pacbell.net
Tue Sep 18 20:16:47 EDT 2001
grante at visi.com (Grant Edwards) wrote in message news:<slrn9qf448.t5c.grante at grante.comtrol.com>...
> In article <MPG.160f1025af35e968989741 at nntp.mindspring.com>, David In VA wrote:
> > I am not sure how to properly write the bitwise operator but I think it
> > will be useful for some thing I need to do. If I want to print "Hello"
> > if the value 2^2 (4) is in a given value (lets say testvalue) how would
> > I do this? I have been trying this
> >
> > if 4 & testvalue:
> > print "hello"
>
> It works for me. How exactly is it not working?
Works for me also. I let testvalue = 8, and if failed, I then let
testvalue = 12, and it printed "hello"
Sam Schulenburg
More information about the Python-list
mailing list