"contro opinion" <contropin...@gmail.com> wrote in message news:ca+ydq_651x0ndpw1j203wgbedtxy_mw7g0w3vh1woagr1iv...@mail.gmail.com... > 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' > I am no expert, but does this answer your question ?
C:\>python Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a1 = 0xf4 >>> a1 244 >>> b1 = '0x{:x}'.format(a1) >>> b1 '0xf4' >>> int(b1, 16) 244 >>> a2 = 0o36 >>> a2 30 >>> b2 = '0o{:o}'.format(a2) >>> b2 '0o36' >>> int(b2, 8) 30 >>> a3 = 011 File "<stdin>", line 1 a3 = 011 ^ SyntaxError: invalid token >>> Frank Millman -- https://mail.python.org/mailman/listinfo/python-list