Agamemnon
Agamemnon

Reputation: 3

TypeError on beautifulsoup file open

I don't see why I'm getting an error on this. Could someone nice explain to me what's happening? I tried to follow some other examples, but apparently I have failed :P

import BeautifulSoup as bs

def readHTML():
    soup = bs("stats.html")
    print(soup.prettify())

Why am I getting a type error?

TypeError: 'module' object is not callable

Upvotes: 0

Views: 46

Answers (1)

Wondercricket
Wondercricket

Reputation: 7882

You need to utilize the class "BeautifulSoup" that is within the module

from BeautifulSoup import BeautifulSoup as bs

def readHTML():   
    soup = bs("stats.html")
    print(soup.prettify())

Upvotes: 1

Related Questions