How to change the number into the same expression's string and vice versa?

contro opinion contropinion at gmail.com
Mon Jan 19 04:01:31 EST 2015


In the python3 console:

    >>> a=18
    >>> b='18'
    >>> str(a) == b
    True
    >>> int(b) == a
    True


Now how to change a1,a2,a3  into b1,b2,b3 and vice versa?
a1=0xf4
a2=0o36
a3=011

b1='0xf4'
b2='0o36'
b3='011'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150119/1355a0af/attachment.html>


More information about the Python-list mailing list