Hi I'm new to Python, I tried to pick a project that would help me learn the language so I decided on a script that would allow me to search google.
For the most part i've got the basics, however, I'm having some confusion with strings, my strings are prefixed with b, what does that mean b'string'. I had to do that to my regular expression to get it to work properly. But what does it mean exactly, is it really necessary?
conn = http.client.HTTPConnection("www.google.com")
conn.request("GET", "/search?q=" + q)
r1 = conn.getresponse()
self.status = r1.status
self.reason = r1.reason
if self.status == 200:
self.data = r1.read()
reobj = re.compile(b'<a href="([^"]*)" class=l>(.*?)</a>')
result = reobj.findall(self.data)
for res in result:
c = GoogleQuery()
print("Unable to query google, got error: ",c.status," -- ", c.reason)