Python2.6 Decimal to Octal

user233935 picture user233935 · Apr 3, 2010 · Viewed 12.3k times · Source

How can i convert decimal to Octal in Python2.6, for 1 to 100000? I wanna get this converted result as .txt too. Can someone help me?

Answer

Andrew Hare picture Andrew Hare · Apr 3, 2010

Use the oct function:

print oct(9) # prints 011