[ python-Bugs-1215146 ] int('x',radix) puzzle

SourceForge.net noreply at sourceforge.net
Sun Jun 5 15:11:51 CEST 2005


Bugs item #1215146, was opened at 2005-06-05 06:11
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1215146&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: elgordo (azgordo)
Assigned to: Nobody/Anonymous (nobody)
Summary: int('x',radix) puzzle

Initial Comment:
I don’t understand the built-in function int(x, radix). Or 
its documentation in the Library Reference section 2.1 – 
Built-In Functions. I’m using Python 2.4.1 on Windows 
XP Pro w/SP2, And I get the following on IDLE:

>>> int(9)
9
>>> int('9')
9
>>> int('9',2)

Traceback (most recent call last):
  File "<pyshell#31>", line 1, in -toplevel-
    int('9',2)
ValueError: invalid literal for int(): 9
>>> int('9',8)

Traceback (most recent call last):
  File "<pyshell#32>", line 1, in -toplevel-
    int('9',8)
ValueError: invalid literal for int(): 9
>>> int('9',10)
9
>>> int('9',16)
9
>>> int('19',16)
25
>>>


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1215146&group_id=5470


More information about the Python-bugs-list mailing list