Skip to content

Instantly share code, notes, and snippets.

@devdave
Created December 29, 2012 20:12
Show Gist options
  • Save devdave/4409116 to your computer and use it in GitHub Desktop.
Save devdave/4409116 to your computer and use it in GitHub Desktop.
String to numeric telephone string - used by me to pick arbitrary but meaningful port #'s
def str2tel(word):
n2a = {2: 'abc', 3: 'def', 4: 'ghi', 5: 'jkl', 6: 'mno', 7: 'pqrs', 8: 'tuv', 9: 'wxyz'}
for t in word:
for k,i in n2a.items():
if t in i: print k,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment