Y
Y
yuki2020-09-23 19:46:04
Python
yuki, 2020-09-23 19:46:04

How to count csv and correctly distribute everything in the sheet?

I have a csv file with such data.
5f6b7b6509e60432233667.png
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}

Initial code
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 question

Ask a Question

731 491 924 answers to any question