Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- try:
- conn = psycopg2.connect(database = 'shop', user = 'admin1', host = "127.0.0.1", password = '1')
- except:
- print ("I am unable to connect to the database")
- cur = conn.cursor()
- try:
- cur.execute("""CREATE TABLE testtb(idx integer)""")
- except:
- print ("I can't CREATE")
- try:
- cur.execute("""INSERT INTO testtb(idx) VALUES(1)""")
- except:
- print ("i can't INSERT")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement