On Tue, 24 May 2005, Kent Johnson wrote:
> D. Hartley wrote: > > I have a question: what is the "opposite" of hex()? (i.e., like ord > > and chr). If I have > > > > '0x73', how can I get back to 115 or s? > > I don't know a really clean way to do this because '0x73' is not a legal > input value for int(). int() needs a little bit more hinting in this case: it can take in a seceond parameter whose value is the "base". For example: ###### >>> int('001010101001', 2) 681 >>> int('0x73', 16) 115 ###### Bets of wishes! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor