Skip to content

Instantly share code, notes, and snippets.

@trsqxyz
Last active August 29, 2015 14:06
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 trsqxyz/fcae978769220c05321f to your computer and use it in GitHub Desktop.
Save trsqxyz/fcae978769220c05321f to your computer and use it in GitHub Desktop.
def mostbytes(text, removeword=None):
text = list(set(text))
if removeword:
if not isinstance(removeword, int):
removeword = ord(removeword)
text.remove(removeword)
if len(text) <= 1: return bytes([ord(chr(text))])
ruleout = [ord(w) for w in ['+', '=', '/', '\n']]
most = max(text, key=text.index)
if most in ruleout:
mostbytes(text, most)
return bytes([ord(chr(most))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment