Guest User

Untitled

a guest
Nov 17th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import csv
  2.  
  3. with open("scores1.csv", "w") as csvfile:
  4. fieldnames = ["score", "username","topic","difficulty",]
  5. writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
  6.  
  7. writer.writeheader()
  8. score = int(input("score" ))
  9. user = input("user: ")
  10. topic = input("topic: ")
  11. difficulty = input("difficulty: ")
  12.  
  13. writer.writerow({"score": score, "username": user, "topic": topic, "difficulty": difficulty})
  14.  
  15. print ()
  16.  
  17. csvfile.close()
Add Comment
Please, Sign In to add comment