Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- with open("scores1.csv", "w") as csvfile:
- fieldnames = ["score", "username","topic","difficulty",]
- writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
- writer.writeheader()
- score = int(input("score" ))
- user = input("user: ")
- topic = input("topic: ")
- difficulty = input("difficulty: ")
- writer.writerow({"score": score, "username": user, "topic": topic, "difficulty": difficulty})
- print ()
- csvfile.close()
Add Comment
Please, Sign In to add comment