while True:
dish = work_with_bd.breakfast('Breakfast.csv')
for s in re.findall(r'\d+', dish[0:5]):
dish_id = int(s)
dish_name = dish.replace(str(dish_id), '')
dish_name = re.findall(r'^\w', dish_name)
description = re.findall('^\.\n*\.\n\n$', dish)
ingr = None
picture = re.findall('^h*jpg$', dish)
dish_type = '1'
c.execute(('''INSERT INTO dishes VALUES
(dish_id, dish_name, description, ingr, picture, dish_type);'''))
break
Может проще через pandas: read csv, потом df о фильтровать и to_sql?
Обсуждают сегодня