Memoet
Search…
Python script to generate CSV file for importing notes
1
import csv
2
3
# This is fixed like the CSV template
4
fieldnames = ['title', 'image', 'content', 'type', 'op1', 'op2', 'op3', 'op4', 'op5', 'correct_op', 'explain']
5
6
# Sample data, you can replace it with any iterator
7
data = [
8
["In the Scoville scale, what is the hottest chemical?", "Resiniferatoxin"],
9
["Dry ice is the solid form of what substance?", "Carbon dioxide"],
10
]
11
12
with open('notes.csv', 'w', newline='') as csvfile:
13
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
14
writer.writeheader()
15
16
for row in data:
17
# Row data will depends on the note type
18
writer.writerow({
19
'title': row[0],
20
'type': "Flash card", # "Multiple choice", "Type answer" or "Flash card"
21
'explain': row[2],
22
})
23
Copied!
Last modified 7mo ago
Copy link