tee chwee liong wrote:
my IDLE seems to be giving me some funny error. i'm using Python 2.5 and Win XP. pls advise.
a=0b110010
SyntaxError: invalid syntax
Base two literals were only added to Python in version 2.6.
[steve@sylar ~]$ python2.6
...
>>> 0b111
7
In 2.5 and older, this is a syntax error:
[steve@sylar ~]$ python2.5
...
>>> 0b111
File "<stdin>", line 1
0b111
^
SyntaxError: invalid syntax
Either upgrade to 2.6, or learn to convert between binary and decimal or
hexadecimal in your head:
>>> 0x07 # like binary 111
7
You can still convert from binary number *strings* in Python 2.5:
>>> int("111", 2)
7
--
Steven
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor