Python Forum
Inserting values from multiple lists sqlite
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inserting values from multiple lists sqlite
#2
I do not know how sqlite works. And you don't give information on your datastructures. But I guess cartproducts and cartprices are lists. So I think you will have to zip those together.
for item1, item2 in zip(cartproducts, cartprices):
      c.executemany("INSERT INTO orders(Product_Name, Product_Price) VALUES(?, ?);", (item1, item2, ))
 connection.commit()
(untested)
Reply


Messages In This Thread
RE: Inserting values from multiple lists sqlite - by ibreeden - May-24-2020, 08:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Using Lists as Dictionary Values bfallert 8 2,346 Apr-21-2024, 06:55 AM
Last Post: Pedroski55
  __init__() got multiple values for argument 'schema' dawid294 4 9,828 Jan-03-2024, 09:42 AM
Last Post: buran
  python convert multiple files to multiple lists MCL169 6 3,366 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  user input values into list of lists tauros73 3 2,011 Dec-29-2022, 05:54 PM
Last Post: deanhystad
  How to combine multiple column values into 1? cubangt 15 7,022 Aug-11-2022, 08:25 PM
Last Post: cubangt
  Help with subtracting values using SQLite & Python Extra 10 5,480 May-10-2022, 08:36 AM
Last Post: ibreeden
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 4,065 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  Create Dict from multiple Lists with duplicate Keys rhat398 10 5,796 Jun-26-2021, 11:12 AM
Last Post: Larz60+
  Function - Return multiple values tester_V 10 6,658 Jun-02-2021, 05:34 AM
Last Post: tester_V
  Better way to append frames from a video to multiple lists? Balaganesh 0 2,443 May-13-2021, 07:37 AM
Last Post: Balaganesh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020