Python Forum
how to insert list into database
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to insert list into database
I am storing <p> tag data into list. When i apply insert query then last line of the list stored in the database.
I want to store all data in database that is available in link.
Below is the code of adding <p> tags data into list:

 content_html_container=soup_loop.find('div', class_="template__main")

    for list_p in content:
        for li in p:
#              print(p)
below is the database query:

 news_detail_query="INSERT INTO news_detail (`date`, heading, content, id_authors, id_categories) VALUES (%s, %s, %s, %s, %s)"
    result  = cursor.execute(news_detail_query, insert_news)
list = [X,Y]

INSERT INTO table VALUES ('%s') %s list

Possibly Related Threads…
Thread Author Replies Views Last Post
  openpyxl insert list with formulas Irv1n 1 239 Sep-16-2021, 08:10 AM
Last Post: Irv1n
Photo Insert 0 values in database saljuaid 4 921 Nov-08-2020, 12:09 PM
Last Post: saljuaid
  Datas are not insert into database aravinth 1 987 Dec-21-2019, 04:17 PM
Last Post: buran
  Create application that will take information from database and insert into PDF sorrelsj 1 1,186 Aug-19-2019, 10:08 PM
Last Post: Gribouillis
  Store a python list of lists in a database to use for searches later on klllmmm 3 1,381 Jun-20-2019, 07:54 AM
Last Post: buran
  Creating a persistent list/database Trinx 1 1,136 Feb-27-2019, 06:20 PM
Last Post: ichabod801
  Insert list in particular column! Help! vndywarhol 0 1,419 Sep-17-2018, 11:14 PM
Last Post: vndywarhol
  insert list into sqlite3 mepyyeti 3 9,805 Jan-15-2018, 06:35 AM
Last Post: Gribouillis
  Newbie question for bulk insert into SQL Server database zydjohn 6 9,647 Dec-14-2017, 11:04 PM
Last Post: Larz60+
  Python 3 MySQL database insert error georgian2all 7 5,551 Aug-01-2017, 06:37 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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