BeautifulSoup

Steve Young drevil_53711 at yahoo.com
Fri Aug 19 11:42:53 EDT 2005


I tried using BeautifulSoup to make changes to the url
links on html pages, but when the page was displayed,
it was garbled up and didn't look right (even when I
didn't actually change anything on the page yet). I
ran these steps in python to see what was up:

>>from BeautifulSoup import BeautifulSoup
>>from urllib2 import build_opener, Request
>>
>>req = Request('http://www.python.org/')
>>f = build_opener().open(req)
>>page = f.read()
>>f.close()
>>
>>len(page)
12040
>>
>>soup = BeautifulSoup()
>>soup.feed(page)
>>page2 = soup.renderContents()
>>len(page2)
11889

I have version 2.1 of BeautifulSoup. It seems that
other ppl have used BeautifulSoup and it works fine
for them so I'm not sure what I'm doing wrong. Any
help would be appreciated, thanks.

-Steve


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



More information about the Python-list mailing list