我是python的新手。我想在eclipse中运行python脚本,因为我对此有点适应。我正在尝试导入和运行美丽汤在eclipse oxygen.Import是成功的,但我得到一个错误(未解决的导入汤)与以下code.However美丽汤是工作良好与anaconda.enter图像描述在这里
从bs4导入BeautifulSoup as soup
我试图用Python 2.7创建一个过程,它从不同的博彩网站(如betfair、ladbrokes等)检索投注赔率,以便进行统计分析。我对python相当陌生(我对所有的I.T术语都很难理解),但我做了一些研究,并提出了以下结构。
from urllib import urlopen
import re
response = urlopen('http://beta.betfair.com/football/event?id=26821411')
html = response.read()
jay = re.compile(b'.*id="m57290-s
我试图使用美丽的汤刮从rottentomatoes.com的电影引号。页面源很有趣,因为引号是由span类“粗体quote_actor”直接进行的,但是引号本身没有类,例如():。
我想使用美丽汤的find_all捕捉所有的引号,没有演员的名字。我尝试过很多没有成功的事情,例如:
moviequotes = soup(input)
for t in web_soup.findAll('span', {'class':'bold quote_actor'}):
for item in t.parent.next_siblings:
我正在尝试使用beautifulsoup.name获取漂亮的汤返回文本。但它只是给了我一个美丽汤对象的文档。对于如何使用Beautiful返回XML文件中的文本,有什么建议吗?
import BeautifulSoup as bsoup
f = open(file)
soup = bsoup(f)
f.close()
f = soup.name
This code will return [document]
But I'm looking to for a function in beautiful soup to return:
<name>car</n
我想从当地一家电影院的网站上刮点东西,当某部电影在运行时,我会一直拍下去。
我找到了一张表格,其中列出了如下形式的时间:
[<time datetime="2020-01-31T21:15:00+01:00">21:15</time>].
如果我用漂亮汤作为x.find_all(“时间”)。我得到了上面所示的所有时间。但我只想要“日期时间”,所以在本例中,2020-01-31T21: 15: 00 + 01: 00。现在当我搜索x.find_all(‘time’)‘日期时间’时,我得到以下错误:
TypeError: list indices must
使用美丽的汤可以做到以下几点:
for heading in soup.find_all('h1'):
print(heading.text)
Top Rated Movies
然而,是否有一种方法来提取标签本身,给出文本?从上述示例向后工作的一种方法,类似于:
soup.find_tag('Top Rated Movies')
h1
我试图让一个循环多次遍历这些链接,它只运行一次,并且似乎排除了除“美丽汤”代码之外的所有其他代码
import requests
import bs4
x = 0
while x < 3:
print(x)
res = requests.get('https://en.wikipedia.org/wiki/Special:Random')
soup = bs4.BeautifulSoup(res.text, 'lxml')
i = soup.select('.firstHeading')
pri
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:源代码字符串不能包含空字节
我需要从Twitter状态URL获取文本,如下所示:
我知道有Twitter,但是我想在循环中尽可能多地进行查询(我存储了几个ids ),而查询Twitter意味着处理限制的代码。
获得:
Quéabuso el gol de Bale.Lleva el balón desde los 3/4 y le gana la carrera a Bartra y con el defensa pegado,por debajo de Pinto 85‘
获得:
我推荐数字海洋--最…
获得:
#Halamadpic.twitter.com/61nJpT5TAO
实际状态
我是一个Python3的初学者,我正在为一个网站做硒项目
我想要的文本位于路径("//div[@class='classname']//span[@class='classname2']).text下
但是没有美汤我就不能提炼出来
for i in postsContainer.extract():
soup = bs(i)
people.append([soup.find("div",{"class":"classname"}).text])
但是如果没有//span部分,它就不能工作。我
我现在是一个学生,我现在学习的是美丽的汤,所以我的讲师就像我一样从商店里收集数据,但是我不能擦拭产品的细节。目前,我正在尝试从中抓取数据。我只想弄清楚产品的名称和价格。有人能告诉我为什么我不能用漂亮汤刮数据吗?
这是我的代码:
from requests import get
from bs4 import BeautifulSoup
url = "https://shopee.com.my/shop/13377506/search?page=0&sortBy=sales"
response= get (url)
soup=BeautifulSoup(response