首页 > 解决方案 > Visual Studio Code 中的二进制或不受支持的文本 Python

问题描述

当我尝试在韩国网站上爬网时,出现如下错误消息。

“此文件未显示在编辑器中,因为它是二进制文件或使用了不受支持的文本编码。”

当我在文件编辑器中打开时,它显示如下。

MZ�uH������������������������

你能帮我解决这个问题吗?谢谢你。

from bs4 import BeautifulSoup
from urllib.request import urlopen 

response = urlopen('https://datalab.naver.com/keyword/realtimeList.naver? 
where=main')
soup = BeautifulSoup(response, 'html.parser')
for anchor in soup.select("span.item_title"):
    print(anchor)
 

标签: pythontextvisual-studio-codebeautifulsoupbinary

解决方案


市场

我不确定这是否是您要寻找的东西,但可能需要研究一下。VS Code 有一个 Marketplace,您可以在其中免费获得扩展


推荐阅读