Newbie question, can’t get my head around it. When I use these 3 lines of code:
import csv
with open('result.csv', mode='a+', newline='') as result:
writer = csv.writer(result)
writer.writerow([a,b,c])
at the end of a small program, I get this error: “TypeError: ‘int’ object is not callable”. When I run the 3 lines of code seperately in a Jupyter cell, it works sometimes but not always? I am trying to append a few variables to a new row of a csv. What’s happening? Thx!!
Adding the statement a, b, c = 1, 2, 3 in front of your code, this works over here.
Could you post a minimal code demonstrating the failure as well as the complete error traceback? (See About the Users category in case you’re unsure how to format these.)
You might also want to try with an empty CSV file. Attach the one you are using if the error does not reproduce then.