Yes, it shows as empty string. But I learned about Scrapy and now I am studying the tutorial. I like it better than BeautifulSoup. For beginners it is better, I think.
On Nov 18, 11:50 am, Peter Pearson <ppear...@nowhere.invalid> wrote: > On Tue, 17 Nov 2009 14:38:55 -0800 (PST), Zeynel <azeyn...@gmail.com> wrote: > > [snip] > > >>>> from BeautifulSoup import BeautifulSoup > > >>>> soup = BeautifulSoup (file("test.html").read()) > >>>> title = soup.find('title') > >>>> titleString = title.string > >>>> open('extract.text', 'w').write(titleString) > > > This runs without an error, but nothing is written into the > > extract.text file. test.html has <title></title> tags in it. > > Hmm. Works for me, but of course I don't have your test.html. > Why don't you try examining "title" and "titleString"? Perhaps > <title></title> has resulted in titleString being the empty string. > > -- > To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list