当我尝试导入漂亮的汤时,我得到了以下错误:
Traceback (most recent call last):
File "my_first_simple_script.py", line 2, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
我尝试通过以下方式导入它:从bs4导入BeautifulSoup
我的python版本是3.6.1,并且漂亮的汤是:'beautifulsoup4==4.6.0‘
我做
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options`
from bs4 import BeautifulSoup
import pandas as pd
to ‘您试图在Python2下使用Python3特定版本的美丽汤。这是行不通的。支持Python2的漂亮汤的最终版本是4.9.3’
ValueError:源代码字符串不能包含空字节
Answer marked below. It was two problems. I was missing a semicolon in the env var path, and the latest Beautiful Soup is incompatible with my python script. Using an older version allowed it to run.
我试图安装漂亮汤在Windows中使用"Setup.py安装“从一个CMD窗口。
我知道下面的错误..。
Z:\Installers\beautifulsoup4-4.1.0>setup
例如,如果以模型为例:
class Region(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=256)
class Company(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=256)
region = models.ForeignKey('Region', db_in
嗨,我有下面的python
#Searching for company
varA = soup.find(Microsoft)
#Finding the <a> tag which contains href
#{<a data-deptmodal="true" href="https://someURL BASED ON COMPANY NAME">TEXT BASED ON COMPANY NAME</a>}
button = org.find_previous('a')
driver.find_elem
我有以下问题(字母表汤)作为我的数据结构课程练习。
我在O(m+s)中解决了这个问题,其中m是消息的长度,s是汤的长度(我刚刚从汤中创建了一个表,并决定是否可以使用该表创建消息)
def checkBowl(message, soup):
d = {}
# O(S)
for c in soup:
d[c] = d.get(c, 0) + 1
# O(m)
for c in message:
if(d.get(c, 0) == 0):
return False
else:
d[c] -= 1
# So the ove