string.py

Gerrit Holl gerrit.holl at pobox.com
Fri Feb 18 10:05:28 EST 2000


Fred L. Drake, Jr. wrote on 950782706:
> 
> Aahz Maruch writes:
>  > I'm assuming, of course, that the revised 1.5.2 documents are correct
>  > and that int() still does not take a radix.
> 
> Aahz,
>   int() in 1.5.2 does not, but 1.6 will:
> 
> Python 1.5.2+ (#276, Feb  1 2000, 15:08:05)  [GCC 2.8.1] on sunos5
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> int('123', 8)
> 83

Cool. Will there also be something the other way?
I can convert int 83 to an octal or hexadecimal string,
but I want to convert it to a string with an arbitrary radix,
for example, 2, to see what it is in binary. Of course,
I could code it myself, but a better half[1] would be a
Good Thing(tm).

[1]
Have I looked up "wederhelft" correctly? It seems wrong to me...

-- 
cat: /home/gerrit/.signature: No such quote or joke




More information about the Python-list mailing list