Reputation: 332
I am new in python. In my python script I want to export data to CSV file. What i did i have created a number.csv file in the folder where my python script is. I am using python 3.6.6. I have tried too many examples, but none of is working. Here is my code :
import csv
nms = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
with open('number.csv', 'w',newline='') as f:
writer = csv.writer(f)
for row in nms:
writer.writerow(row)
Upvotes: 0
Views: 1497
Reputation: 332
Code is working fine, nothing wrong in the code. The problem is I was looking the csv file where my python python script file is, but the csv file is generating in the current user's folder.
Upvotes: 2