Skip to content

Instantly share code, notes, and snippets.

@jonschoning
Last active January 15, 2023 21:33
Show Gist options
  • Save jonschoning/8916f1a54761b6495c653658023426a9 to your computer and use it in GitHub Desktop.
Save jonschoning/8916f1a54761b6495c653658023426a9 to your computer and use it in GitHub Desktop.
hfmt.py
bfmt=(lambda rs,rw=2,rj=' ':(lambda s,w,j:j.join([s[i:i+w]for i in range(0,len(s),w)]))(rs if len(rs)%rw==0else'0'*(rw-len(rs)%rw)+rs,rw,rj))
bfmt("{:b}".format(5<<36), 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment