#!/usr/bin/python import urllib import re # # task # open an url, parse it, and return the lower 512 Mb usb key from microbytes # # 1. open the url # http://docs.python.org/lib/module-urllib.html url = 'http://microbytes.com/products.php?show=all&pcid=239' #filehandle = file('products.php.html') filehandle = urllib.urlopen(url) # loop for each line # http://docs.python.org/lib/bltin-file-objects.html i = 0 for line in filehandle: i = i + 1 # http://docs.python.org/ref/print.html if line.startswith ('
'): taille = "512MB" priceMin = 999.0 regexptr = re.compile('(.*)(