Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myDict = {}
- with open("names.dat") as f:
- myDict = dict(pair.split(":") for pair in line.strip().split(", ") for line in f)
- for key, val in myDict.items():
- print "father: ", key, " son: ", val
- lookUp = raw_input("Enter a son's name: ")
- print myDict[lookUp]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement