Python makes this stuff too easy xD

This commit is contained in:
Luke Rogers 2012-12-10 01:59:33 +13:00
parent 97d250ca27
commit 9f2bffa7a5

View file

@ -8,8 +8,8 @@ def calc(inp):
soup = http.get_soup('http://www.google.com/search', q=inp)
response = soup.find('h2', {'class': 'r'})
if response is None:
result = soup.find('h2', {'class': 'r'})
if not result:
return "Could not calculate '%s'" % inp
return http.unescape(response.contents[0])
return result.contents[0]