In article <[EMAIL PROTECTED]>, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >On Wed, 20 Aug 2008 07:33:32 -0700 (PDT), Alexnb <[EMAIL PROTECTED]> wrote: >> >>Okay, I have used BeautifulSoup a lot lately, but I am wondering, how do you >>open a local html file? >> >>Usually I do something like this for a url >> >>soup = BeautifulSoup(urllib.urlopen('http://www.website.com') > > urllib.urlopen gives you a file-like object for a resource at an url. > > file gives you a file-like object for a file on the local filesystem. > > soup = BeautifulSoup(file('/the/name/of/the/file'))
Except that you should use open() instead of file() -- docs prior to Python 2.5 mistakenly had this reversed. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ Adopt A Process -- stop killing all your children! -- http://mail.python.org/mailman/listinfo/python-list