To my understanding "import package.module" is same as "from package import module". But this is not behaving as expected in case of BeautifulSoup.
from bs4 import BeautifulSoup: This command works fine.
But,
import bs4.BeautifulSoup throws the following error
ModuleNotFoundError: No module named 'bs4.BeautifulSoup'
Any thoughts/help on this?
As colorspeed pointed out above, BeautifulSoup is a class therefore import bs4.BeautifulSoup will result in error. Instead use the syntax from bs4 import BeautifulSoup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With