Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用BeautifulSoup获取标签中的所有内容_Python_Web Scraping_Beautifulsoup - Fatal编程技术网

Python 使用BeautifulSoup获取标签中的所有内容

Python 使用BeautifulSoup获取标签中的所有内容,python,web-scraping,beautifulsoup,Python,Web Scraping,Beautifulsoup,我正在尝试获取文章标签中的所有内容 但是,当使用 print soup.article 它只会发展到“……艺术与艺术与艺术与艺术与文化的融合。” 全部代码: from bs4 import BeautifulSoup import requests request_page = requests.get('http://magazine.magix.com/de/5-tipps-fuer-die-fotobearbeitung/', 'html.parser') source = reque

我正在尝试获取文章标签中的所有内容

但是,当使用

print soup.article
它只会发展到“……艺术与艺术与艺术与艺术与文化的融合。”

全部代码:

from bs4 import BeautifulSoup
import requests

request_page = requests.get('http://magazine.magix.com/de/5-tipps-fuer-die-fotobearbeitung/', 'html.parser')
source = request_page.text
soup = BeautifulSoup(source, "html.parser")
print soup.article.text

我怎样才能得到一切呢?

好的,终于找到了。欢迎来到令人惊叹的刮削世界

标记中,存在一些

标记,guy的意思肯定是

无论如何,它破坏了html流,所以BS很难解析它

我是这样解决的:

from bs4 import BeautifulSoup
import requests

request_page = requests.get('http://magazine.magix.com/de/5-tipps-fuer-die-fotobearbeitung/', 'html.parser')
source = request_page.text
source = source.replace('</br>', '<br/>')
soup = BeautifulSoup(source, "html.parser")
print soup.article
从bs4导入美化组
导入请求
请求页面=请求。获取('http://magazine.magix.com/de/5-tipps-fuer-die-fotobearbeitung/“,”html.parser')
source=请求\页面.text
source=source.replace(“
”,“
”) soup=BeautifulSoup(源代码,“html.parser”) 打印文章
(我将

替换为

。)


这是一条很棒的刮擦皮带,这种东西有很多,请放心:)

抓得好+因此,我想没有一个页面是没有错误的,听起来像是在摆弄。喜欢它:D谢谢你,伙计!