Here is the code I'm using :
import urllib2
import psycopg2
add = 'http://google.com'
res = urllib2.urlopen(add)
url_html = res.read()
con = psycopg2.connect(user='postgres',password='test_pwd',host='localhost',port=5432,database='test_db')
cur = con.cursor()
cur.execute("INSERT INTO output(output) values ('%r')" %(url_html))
#cur.execute("INSERT INTO output(output) values ('''%s''')" %(url_html))
con.commit()
Now its throwing an error because of ' ' as quotes are inside the page's source code too. Can anybody help me out with this. Thanks for your help.