Print the values of src
values for all img
elements found
in a well-formed XHTML document retrieved from the internet.
#!/usr/bin/python
from urllib2 import urlopen
from xml.dom.minidom import parse
dom = parse(urlopen('http://schnell-web.net/'))
for elt in dom.getElementsByTagName('img'):
print elt.getAttribute('src')
Output:
icon/welcome.gif
imag/tove.jpg
imag/wolf.jpg
imag/arvin.jpg
imag/ilan.jpg