Re: how to scrape url out of href

2006-01-01 Thread homepricemaps
sorry paul-i'm an extremely beginner programmer, if that! ;-) can you give me an example? thanks in advance Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > does anyone have sample code for scraping the actual url out of an href > > like this one > > > > http://www.cnn.com"; target="_blank"> > >

how to scrape url out of href

2006-01-01 Thread homepricemaps
i need to scrape a url out of an href. it seems that people recommend that i use beautiful soup but had some problems. does anyone have sample code for scraping the actual url out of an href like this one http://www.cnn.com"; target="_blank"> -- http://mail.python.org/mailman/listinfo/python-l

Re: scrape url out of brackets?

2005-12-31 Thread homepricemaps
so you recommend using some sort of for statement with the html parser where i tell it to only parse stuff found in the tag for instance? Ravi Teja wrote: > Regular Expressions are the most common way. > http://docs.python.org/lib/module-re.html > > HTML parser is another > http://docs.python.org

Re: why writing list to file puts each item from list on seperate line?

2005-12-30 Thread homepricemaps
never mind i figured out what you were saying,. worked like a charm! thanks for your help. yaffa -- http://mail.python.org/mailman/listinfo/python-list

Re: why writing list to file puts each item from list on seperate line?

2005-12-30 Thread homepricemaps
i want them to be on the same line when they are written to the file. right now they are written like this: food price store i want them to be written like this food price store how do i do that? -- http://mail.python.org/mailman/listinfo/python-list

why writing list to file puts each item from list on seperate line?

2005-12-30 Thread homepricemaps
if i use the code below to write a list to a file list = (food, price, store) data.append(list) f = open(r"test.txt", 'a') f.write ( os.linesep.join( list ) ) it outputs to a file like this apple .49 star market and i want it to do apple, .49. star market any ideas -- http://mail.python.or

why writing list to file puts each item from list on seperate line?

2005-12-30 Thread homepricemaps
if i use the code below to write a list to a file list = (food, price, store) data.append(list) f = open(r"test.txt", 'a') f.write ( os.linesep.join( list ) ) it outputs to a file like this apple .49 star market and i want it to do apple, .49. star market any ideas -- http://mail.python.or

Re: help with lists and writing to file in correct order

2005-12-29 Thread homepricemaps
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

Re: help with lists and writing to file in correct order

2005-12-29 Thread homepricemaps
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

Re: help with lists and writing to file in correct order

2005-12-27 Thread homepricemaps
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 que

Re: help with lists and writing to file in correct order

2005-12-26 Thread homepricemaps
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

Re: help with lists and writing to file in correct order

2005-12-26 Thread homepricemaps
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

Re: help with lists and writing to file in correct order

2005-12-26 Thread homepricemaps
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 > &g

Re: help with lists and writing to file in correct order

2005-12-26 Thread homepricemaps
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

help with lists and writing to file in correct order

2005-12-26 Thread homepricemaps
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 found ni the html including pizza, burgers, fries etc. what i want is to

nonetype error is not callable

2005-12-25 Thread homepricemaps
if i do the following i get the url of an image i am looking for image = "" image = bs.img print image however if i do this out.write (image ) i get an error that says "nonetype error is not callable" any ideas -- http://mail.python.org/mailman/listinfo/python-list

need help with python syntax

2005-12-24 Thread homepricemaps
if i have a piece of html that looks like this cnn.com and i want to scrape out cnn.com , what syntax would i use? i have tried this and it doesn't work for incident in bs('td', {'class' : 'rulesbody'}, {'class' : 'rulesbody'} ): -- http://mail.python.org/mailman/listinfo/python-list

scrape url out of brackets?

2005-12-24 Thread homepricemaps
any idea how to scrape a url out of a file? for instance if i want to scrape out the href at the end which is "www.cnn.com" is there a way to do it? -- http://mail.python.org/mailman/listinfo/python-list