Skip to content

Instantly share code, notes, and snippets.

@aphexmunky
Created January 18, 2019 11:54
Show Gist options
  • Save aphexmunky/c8a070385fb015cf6fd3bd8f89700c25 to your computer and use it in GitHub Desktop.
Save aphexmunky/c8a070385fb015cf6fd3bd8f89700c25 to your computer and use it in GitHub Desktop.
python int to base conversion
def toStr(n,base):
convertString = "0123456789ABCDEF"
if n < base:
return convertString[n]
else:
return toStr(n//base,base) + convertString[n%base]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment