Posted in python
11:14 pm, March 28, 2021

Python import into SQLite research

Some examples i found while researching this import from python scripts into sqlite.

Example weather import beautiful soup


def weather_():
page = requests.get("")
soup = BeautifulSoup(page.content, 'html.parser')
today = soup.find('div',{'data-component-id' : 'forecast'})
temp = today.find(class_ = 'wr-day-temperature')
low_temp = (temp.get_text())
return low_temp

Insert into SQLite.


import sqlite3
conn = sqlite3.connect('your_database.sqlite3', check_same_thread=False)
curs = conn.cursor()
curs.execute("INSERT INTO your_table_name low_temp='{}'".format(low_temp))
curs.execute("INSERT INTO your_table_name low_temp=?", (low_temp,))

Insert or update


INSERT INTO visits (ip, hits)
VALUES ('', 1)
ON CONFLICT(ip) DO UPDATE SET hits = hits + 1;



No Items Found.

Add Comment
Type in a Nick Name here
Page Views

This page has been viewed 403 times.

Search Articles
Search Articles by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
There is a qualitative and quantitative difference between a day that begins with a little exercise, a book, meditation, a good meal, a thoughtful walk, and the start of a day that begins with a smartphone in bed.