Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from urlib.request import urlopen
- import json
- import psycopg2
- import psycopg2.extras
- try:
- db = psycopg2.connect("dbname=myapp user=postgres password=postgres")
- cursor = db.cursor()
- query = "select city from myapp"
- cursor.execute(query)
- data = cursor.fetchall()
- for row in data:
- print (row)
- db.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement