Skip to content

Instantly share code, notes, and snippets.

@juliengrenier
Created January 4, 2012 18:51
Show Gist options
  • Save juliengrenier/1561439 to your computer and use it in GitHub Desktop.
Save juliengrenier/1561439 to your computer and use it in GitHub Desktop.
String to binary representation
str = 'a string'
binary_representation = ''.join([bin(ord(c))[2:].zfill(8) for c in str])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment