Answer the question
In order to leave comments, you need to log in
How to count csv and correctly distribute everything in the sheet?
I have a csv file with such data.
I need to read it in lst = [] so that there is no such nonsense
{'№': '№;naimenovanie;kolvo;;', 'naimenovanie': None, 'kolvo': None, 'vremya': None, 'zamena': None, 'ost': None}
{'№': '1;Pelmeni;500;;', 'naimenovanie': None, 'kolvo': None, 'vremya': None, 'zamena': None, 'ost': None}
{'№': '2;Adrenalin;450;;', 'naimenovanie': None, 'kolvo': None, 'vremya': None, 'zamena': None, 'ost': None}
def read_csv(data):
fieldname = ["№", "naimenovanie", "kolvo"]
with open("data.csv") as csvfile:
reader = csv.DictReader(csvfile, fieldnames=fieldname)
for row in reader:
data.append(row)
for row in data:
print(row)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question