flag -n um nach NATO zu übersetzen
This commit is contained in:
parent
580be19ead
commit
4862164d04
14
tafel.py
14
tafel.py
@ -42,7 +42,7 @@ nato_tafel = {
|
||||
"G": "Golf",
|
||||
"H": "Hotel",
|
||||
"I": "India",
|
||||
"J": "Juliett"
|
||||
"J": "Juliett",
|
||||
"K": "Kilo",
|
||||
"L": "Lima",
|
||||
"M": "Mike",
|
||||
@ -62,11 +62,11 @@ nato_tafel = {
|
||||
}
|
||||
|
||||
|
||||
def to_buchstabierfassung(inputstring):
|
||||
def to_buchstabierfassung(inputstring, tafel=buchstabiertafel):
|
||||
output = inputstring + ": "
|
||||
for letter in inputstring:
|
||||
if letter == ' ': continue
|
||||
output += buchstabiertafel[str.upper(letter)] + ' '
|
||||
output += tafel[str.upper(letter)] + ' '
|
||||
print(output)
|
||||
|
||||
def main():
|
||||
@ -78,7 +78,11 @@ def main():
|
||||
to_buchstabierfassung("Felix")
|
||||
to_buchstabierfassung("Pankratz")
|
||||
else:
|
||||
for word in sys.argv[1:]:
|
||||
to_buchstabierfassung(word)
|
||||
if sys.argv[1] == '-n':
|
||||
for word in sys.argv[2:]:
|
||||
to_buchstabierfassung(word, tafel=nato_tafel)
|
||||
else:
|
||||
for word in sys.argv[1:]:
|
||||
to_buchstabierfassung(word)
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user