base convert by hex

while(1):\x0d
 i=raw_input();k=int(i[-2:]);n=int(i[:-2]);d=[]\x0d
 while(n>0):r=n%k;n/=k;d.insert(0,str(r))\x0d
 print "".join(d)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page