Skip to content

Instantly share code, notes, and snippets.

@CreateRemoteThread
Created April 17, 2016 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CreateRemoteThread/e8a9ee6a542bc564c2b3da18096baf0c to your computer and use it in GitHub Desktop.
Save CreateRemoteThread/e8a9ee6a542bc564c2b3da18096baf0c to your computer and use it in GitHub Desktop.
import string
digs = string.digits + string.letters
def int2base(x, base):
if x < 0: sign = -1
elif x == 0: return digs[0]
else: sign = 1
x *= sign
digits = []
while x:
digits.append(digs[x % base])
x /= base
if sign < 0:
digits.append('-')
digits.reverse()
return ''.join(digits)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment