You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Deze repo is gearchiveerd. U kunt bestanden bekijken en het klonen, maar niet pushen of problemen/pull-requests openen.
|
- import sys
-
-
- def build_airport_dict():
- result = dict()
- file = open("airports.txt", "r")
- contents = file.read()
- lines = contents.splitlines()
- for line in lines:
- words = line.split(" ", maxsplit=1)
- assert len(words) == 2
- code = words[0]
- name = words[1].strip()
- result[code] = name
- return result
-
-
- def main():
- if len(sys.argv) < 2:
- sys.exit("Not enough arguments")
-
- airport_dict = build_airport_dict()
- code = sys.argv[1]
- if code not in airport_dict:
- sys.exit("Code not found")
- result = airport_dict[code]
- print(result)
-
-
- main()
|