[EMAIL PROTECTED] wrote:
> hey mike-the sample code was very useful. have 2 questions
>
> when i use what you wrote which is listed below i get told
> unboundlocalerror: local variable 'product' referenced before
> assignment.
You would get this error if you have a that doesn't have an . Do y
hey mike-the sample code was very useful. have 2 questions
when i use what you wrote which is listed below i get told
unboundlocalerror: local variable 'product' referenced before
assignment. if i however chnage row to incident in "for incident in
bs('tr'):" i then get mytuples printed out nicel
[EMAIL PROTECTED] writes:
> hey kent thanks for your help.
>
> so i ended up using a loop but find that i end up getting the same set
> of results every time. the code is here:
>
> for incident in bs('tr'):
> data2 = []
> for incident in bs('h2', {'id' : 'dealName'}):
>
hey kent thanks for your help.
so i ended up using a loop but find that i end up getting the same set
of results every time. the code is here:
for incident in bs('tr'):
data2 = []
for incident in bs('h2', {'id' : 'dealName'}):
product2 = ""
fo
[EMAIL PROTECTED] wrote:
> sorry guys, here is the code
>
> for incident in bs('a', {'class' : 'price'}):
> price = ""
> for oText in incident.fetchText( oRE):
> price += oText.strip() + "','"
>
> for incident in bs('div', {'class' : 'store'}):
> st
On Tue, 27 Dec 2005 20:11:59 -0800, homepricemaps wrote:
> hey steven-your examlpe was very helpful. is there a paragraph symbolg
> missing in
>
> fp.write("Food = %s, store = %s, price = %s\n" % triplet
No, but there is a closing bracket missing:
fp.write("Food = %s, store = %s, price = %s\n"
hey steven-your examlpe was very helpful. is there a paragraph symbolg
missing in
fp.write("Food = %s, store = %s, price = %s\n" % triplet
Steven D'Aprano wrote:
> On Mon, 26 Dec 2005 20:56:17 -0800, homepricemaps wrote:
>
> > sorry for asking such beginner questions but i tried this and nothing
Why don't you use pickle instead of directly writing to the file yourself?
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 26 Dec 2005 20:56:17 -0800, homepricemaps wrote:
> sorry for asking such beginner questions but i tried this and nothing
> wrote to my text file
>
> for food, price, store in bs(food, price, store):
> out = open("test.txt", 'a')
> out.write (food + price + stor
[EMAIL PROTECTED] wrote:
> sorry for asking such beginner questions but i tried this and nothing
> wrote to my text file
>
> for food, price, store in bs(food, price, store):
> out = open("test.txt", 'a')
> out.write (food + price + store)
>
sorry for asking such beginner questions but i tried this and nothing
wrote to my text file
for food, price, store in bs(food, price, store):
out = open("test.txt", 'a')
out.write (food + price + store)
out.close()
while if i write
[EMAIL PROTECTED] wrote:
> the problem with writing to teh file immidiately is that it ends up
> writing all food items together, and then all store items and then all
> prices
>
> i want
>
> food, store, price
> food, store, price
>
Well, if it all fits in memory, append each to its own list, a
the problem with writing to teh file immidiately is that it ends up
writing all food items together, and then all store items and then all
prices
i want
food, store, price
food, store, price
--
http://mail.python.org/mailman/listinfo/python-list
here is the write part:
out = open("test.txt", 'a')
out.write (store+ food+ price + "\n")
out.close()
Steven D'Aprano wrote:
> On Mon, 26 Dec 2005 17:44:43 -0800, homepricemaps wrote:
>
> > sorry guys, here is the code
> >
> > for incident in bs('a', {'class' : 'price'}):
>
On Mon, 26 Dec 2005 17:44:43 -0800, homepricemaps wrote:
> sorry guys, here is the code
>
> for incident in bs('a', {'class' : 'price'}):
> price = ""
> for oText in incident.fetchText( oRE):
> price += oText.strip() + "','"
>
> for incident in bs('div', {
sorry guys, here is the code
for incident in bs('a', {'class' : 'price'}):
price = ""
for oText in incident.fetchText( oRE):
price += oText.strip() + "','"
for incident in bs('div', {'class' : 'store'}):
store = ""
for oText in incident.fetc
On Mon, 26 Dec 2005 13:54:37 -0800, homepricemaps wrote:
> hey folks,
>
> have a logic question for you. appreciate the help in advance.
>
> i am scraping 3 pieces of information from the html namely the food
> name , store name and price. and i am doing this for many different
> food items fo
17 matches
Mail list logo