Created
December 29, 2012 20:12
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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