How can I convert the decimal to Octal in Python2.6, for 1 to 100000? I want to get this converted result as .txt. Can anybody help me?
Use the oct function:
oct
print oct(9) # prints 011
This should do the trick:
text = '\n'.join(str(oct(i)) for i in xrange(100000)) f = open('foo.txt', 'w') f.write(text) f.close()