python中beautifulsoup是什么库_在Python中使用BeautifulSoup库

作者在遵循Python地图创建教程时遇到困难,因找不到名为'beautifulsoup'的文件。文章探讨了如何在没有该文件的情况下正确导入BeautifulSoup,建议将bs4文件夹移到脚本同级目录或通过包管理器安装。
摘要由CSDN通过智能技术生成

I'm following a tutorial on creating a map using Python and the Beautiful Soup library.

I have downloaded beautiful soup and the folder is called "beautifulsoup4-4.1.3". The contents of this folder are in the attached image.

During the tutorial I am given the following code to use to import my data and beautiful soup:

import csv

from BeautifulSoup import BeautifulSoup

Trouble is that there is no file called "beautiful soup" within the beautiful soup folder. I have also attached the error message I receive in the terminal.

How should I import beautiful soup when there is no file with that name? I tried simply changing the folders name to "beautiful soup". I did not expect that to work and I was right - it did not.

Any advice on how to proceed welcome?

解决方案

Either move the bs4 folder in the same directory as your script, or install the module via easy_install or pip. Then you can import it like this:

from bs4 import BeautifulSoup

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值