PW Akshay

Generation

generate functionMon, 14 Nov 2022

communicate with google website through code

import urllib import urllib2 values = {'q' : 'python programming tutorials'} data = urllib.urlencode(values) url = 'http://www.google.com/search?' + data req = urllib2.Request(url) resp = urllib2.urlopen(req) respData = resp.read() saveFile = open('withHeaders.txt','w') saveFile.write(str(respData)) saveFile.close()

Questions about programming?Chat with your personal AI assistant