Re: Beautifulsoup code that is not running

2009-11-18 Thread Peter Pearson
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


Re: Beautifulsoup code that is not running

2009-11-18 Thread Zeynel
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


Beautifulsoup code that is not running

2009-11-17 Thread Zeynel
Hello,

Please help with this code suggested in the beautifulsoup group
http://groups.google.com/group/beautifulsoup/browse_frm/thread/d288555c6992ceaa

 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.

Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beautifulsoup code that is not running

2009-11-17 Thread Brian J Mingus
On Tue, Nov 17, 2009 at 3:38 PM, Zeynel azeyn...@gmail.com wrote:

 Hello,

 Please help with this code suggested in the beautifulsoup group

 http://groups.google.com/group/beautifulsoup/browse_frm/thread/d288555c6992ceaa

  from BeautifulSoup import BeautifulSoup

  soup = BeautifulSoup (file(test.html).read())
  title = soup.find('title')
  titleString = title.string
  open('extract.text', 'w').write(titleString)


The problem has nothing to do with BeautifulSoup

 from BeautifulSoup import BeautifulSoup
 print BeautifulSoup('titlemytitle/title').title.string
mytitle
-- 
http://mail.python.org/mailman/listinfo/python-list