How should I extract nested list for saving to database?


Unpack operation not allowed in this context

My code for doing it:

def save_data_to_database(self):
    parsed_records = self.parse_sheet_data()
    for record in parsed_records:
            "sheet", #table name
            "id, number_of_order, cost, delivery_time" # These are fields in table
            f"{*record}" # Here I'm trying to unpack values, but I can't

Value of ‘parsed_records’ looks like:

[['1', '1249708', '675', '24.05.2022'], ['2', '1182407', '214', '13.05.2022'], ['3', ...]]

If you see code in above, I want to unpack record with " * " but I can’t.
What should I do for saving records to db?

>Solution :

See if this solve your problem


Leave a Reply