Skip to content

Instantly share code, notes, and snippets.

@tpaschalis
Last active June 3, 2020 14:06
Show Gist options
  • Save tpaschalis/1f6e70e1a12960a2ac3e3ce7c32c4401 to your computer and use it in GitHub Desktop.
Save tpaschalis/1f6e70e1a12960a2ac3e3ce7c32c4401 to your computer and use it in GitHub Desktop.
Words that are also hex numbers
import re
def is_hex(word):
match = re.match("^[a-f]*$", word)
return match is not None
with open('/usr/share/dict/american-english') as file:
lines = file.readlines()
for item in lines:
if is_hex(item.lower()) and len(item)>2:
print(item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment