Can someone help why my csv file is not opening and not saving my answers? Please help
The code works but I cannot see the csv file opening
I want to make sure the csv file opens and that my answers will be automatically saved
https://replit.com/@rebeccasaxion/EchteversievragenlijstSTEMILseRebecca?v=1
import csv
csvfile=open("antwoorden.csv","a")
data=csv.writer(csvfile,delimiter=",")
data.writerow(antwoorden)
csvfile.close()
umm… I don’t see a file called antwoorden.csv
??
3 Likes
I thought when you imported a csv file thing, the file "antwoorden.csv’’ automatically opens. I tried it once before and then the csv file did open automatically
It only opens automatically when reading it. Opening it in append mode will not do this. Also, antwoorden
is not defined. It should be "antwoorden"
.
2 Likes
Oh thank you! The only thing is that I apparently had to do it in append mode. This code is for a school project
3 Likes
Next time, remember to specify that it’s an assignment in the title, as we have special rules for those.
3 Likes
so if you’re reading a file then if the file doesn’t yet exist it will throw an error
2 Likes
ok but please put some code in your post so that people who have similar problems can figure it out
system
Closed
June 19, 2023, 3:42pm
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.