diff --git a/tafel.py b/tafel.py index 70cf7d1..97f79d6 100755 --- a/tafel.py +++ b/tafel.py @@ -29,7 +29,17 @@ buchstabiertafel = { "Z": "Zacharias", "Ä": "Ärger", "Ö": "Ökonom", - "Ü": "Übermut" + "Ü": "Übermut", + "0": "Null", + "1": "Eins", + "2": "Zwo", + "3": "Drei", + "4": "Vier", + "5": "Fünf", + "6": "Sechs", + "7": "Sieben", + "8": "Acht", + "9": "Neun" } nato_tafel = { @@ -66,7 +76,10 @@ def to_buchstabierfassung(inputstring, tafel=buchstabiertafel): output = inputstring + ": " for letter in inputstring: if letter == ' ': continue - output += tafel[str.upper(letter)] + ' ' + try: + output += tafel[str.upper(letter)] + ' ' + except KeyError: + output += letter + ' ' print(output) def main():