urlopen() error
Rafal Zawadzki
bluszcz at jabberpl.org
Fri Sep 8 18:13:37 EDT 2006
Tempo wrote:
> Hello. I am getting an error and it has gotten me stuck. I think the
> best thing I can do is post my code and the error message and thank
> everybody in advanced for any help that you give this issue. Thank you.
>
> #############
> Here's the code:
> #############
>
> import urllib2
> import re
> import xlrd
> from BeautifulSoup import BeautifulSoup
>
> book = xlrd.open_workbook("ige_virtualMoney.xls")
> sh = book.sheet_by_index(0)
> rx = 1
> for rx in range(sh.nrows):
> u = sh.cell_value(rx, 0)
> page = urllib2.urlopen(u)
> soup = BeautifulSoup(page)
> p = soup.findAll('span', "sale")
> p = str(p)
> p2 = re.findall('\$\d+\.\d\d', p)
> for price in p2:
> print price
> ValueError: unknown url type: List
^^^^^^^^^^^^^^^^^^^^^^
I don't xlrd, but:
http://docs.python.org/lib/module-urllib2.html
urlopen( url[, data])
Open the URL url, which can be either a string or a Request object.
data should be a string, which specifies additional data to send to the
server. In HTTP requests, which are the only ones that support data, it
should be a buffer in the format of application/x-www-form-urlencoded, for
example one returned from urllib.urlencode().
What is your _u_?
--
Rafał Zawadzki [jid/mail: bluszcz at jabberpl.org, skype: blvszcz]
http://glam.pl - używane ciuchy, vintage, secondhand
http://bluszcz.net - moja strona domowa
More information about the Python-list
mailing list