dimanche 21 février 2016

extracting hyperlinks in python.

Im trying to make a simple web browser in python. (i'm a novice programmer and this is the first time I'm using python.) I'm aware that i have to save my links in a list and create a function to to go to my url overtime sees that list but i have no idea how to do that. I would very much appreciate it if someone could please help me with that.

Heading

Here's my code: #!/usr/bin/env python

import urllib

url = "http://google.com"
data = urllib.urlopen(url)
tokens = data.read().split()
List=[]
for token in tokens:
if token == '<body>':
 print ''
elif token == '</body>':
print ''
#elif token[6:-2] == '<a href':
  else:
enter code here









print token,


selectedLink = raw_input('Select a link:')




Aucun commentaire:

Enregistrer un commentaire