Untitled

 avatar
unknown
plain_text
a year ago
1.5 kB
6
Indexable
import csv


class Product:
    def __init__(self, nbb_article, manufacturer_id, products_aen, product_name, product_type, manufacturer,
                 net_price, availability, stock, shipping_method):
        self.nbb_article = nbb_article
        self.manufacturer_id = manufacturer_id
        self.products_aen = products_aen
        self.product_name = product_name
        self.product_type = product_type
        self.manufacturer = manufacturer
        self.net_price = net_price
        self.availability = availability
        self.stock = stock
        self.shipping_method = shipping_method

    def __repr__(self):
        return self.manufacturer_id + "//" + self.product_name


result = []

with open('b2bindividuelllive_reseller977de.csv', 'r', encoding='utf-8') as csv_file:
    csv_content = csv.reader(csv_file, delimiter=";")

    next(csv_content)

    for csv_row in csv_content:
        nbb_article, manufacturer_id, products_aen, product_name, product_type, manufacturer, net_price, availability, stock, shipping_method = csv_row
        product = Product(nbb_article=nbb_article, manufacturer_id=manufacturer_id, products_aen=products_aen,
                          product_name=product_name, product_type=product_type, manufacturer=manufacturer,
                          net_price=net_price, availability=availability, stock=stock, shipping_method=shipping_method)
        result.append(product)

for row in result:
    print(row)
Editor is loading...
Leave a Comment