Skip to content

Instantly share code, notes, and snippets.

@rogersguedes
Created November 21, 2019 17:01
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 rogersguedes/3dd4622f69d7c61974a220cf446a00cf to your computer and use it in GitHub Desktop.
Save rogersguedes/3dd4622f69d7c61974a220cf446a00cf to your computer and use it in GitHub Desktop.
#!/usr/bin/python
def getBinStr(num, dig):
return format(num, '#0'+str(dig+2)+'b')
def getHexStr(num, dig):
return '0x{0:0{1}X}'.format(num, dig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment