Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://www.facebook.com/groups/2616981278627207/posts/3463307970661196/?#__cft__[0]=AZVmZFrUsYPKRacZF8RpXemuyUKpFucuEkG2Duyq0ERwNHOHx492MdyhOkjflolibNVmTukTtOPRRCbwDIvvIdl62CNBVyev3opFIzpjj9tn8DHnjPdOLKSWiPs#wYwyB6UEridkyreMJ_40HRpLntgGN&__tn__=%2CO%2CP-R
- #!/usr/bin/python
- #!/usr/env/python
- #
- # file with items to choose
- #
- # scientific_materials.txt
- # struct:
- # mat:Math
- # phy:Physics
- # physics:Physics
- FILE_NAME = "scientific_materials.txt"
- def main(args):
- # creating options dictionary
- items = {}
- with open(FILE_NAME) as file:
- for line in file:
- if line.startswith("#"):
- continue
- line = line.split("\n")[0]
- items[line.split(":")[0]] = line.split(":")[1]
- answ = input("Enter what you are interested in: ").lower()
- print("Choosen: {}".format(items.get(answ, "nothing")))
- if __name__ == "__main__":
- import sys
- sys.exit(main(sys.argv))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement