Skip to content

Instantly share code, notes, and snippets.

@slubman
Created February 22, 2010 13:32
Show Gist options
  • Save slubman/311067 to your computer and use it in GitHub Desktop.
Save slubman/311067 to your computer and use it in GitHub Desktop.
Convert a word or a phrase to NATO phonetic alphabet
#!/usr/bin/env python
import sys
codes = {
'a' : "Alpha",
'b' : "Bravo",
'c' : "Charlie",
'd' : "Delta",
'e' : "Echo",
'f' : "Foxtrot",
'g' : "Golf",
'h' : "Hotel",
'i' : "India",
'j' : "Juliet",
'k' : "Kilo",
'l' : "Lima",
'm' : "Mike",
'n' : "November",
'o' : "Oscar",
'p' : "Papa",
'q' : "Quebec",
'r' : "Romeo",
's' : "Sierra",
't' : "Tango",
'u' : "Uniform",
'v' : "Victor",
'w' : "Whisky",
'x' : "XRay",
'y' : "Yankee",
'z' : "Zulu",
'0' : "Zero",
'1' : "One",
'2' : "Two",
'3' : "Three",
'4' : "Four",
'5' : "Five",
'6' : "Six",
'7': "Seven",
'8' : "Eight",
'9' : "nine"
}
print "Traduction de \"%s\"" % sys.argv[1]
for lettre in sys.argv[1].lower():
if lettre in codes:
print codes[lettre]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment