Created
March 18, 2022 20:08
-
-
Save mujeebishaque/ce72016a480ac739c355083f03b28f53 to your computer and use it in GitHub Desktop.
create database and table sqlite3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_if_not_exists(): | |
try: | |
import sqlite3 | |
connection = sqlite3.connect('database.db') | |
cursor = connection.cursor() | |
cursor.execute(''' | |
CREATE TABLE IF NOT EXISTS listings | |
(listing_url TEXT, current_price TEXT) | |
''') | |
show_success("SUCCESS: Connected to the database!") | |
except: | |
show_error("ERROR: Can't create a database in this directory!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment