python - 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)
解决方案
推荐阅读
- asp.net-core - OpenXML MainDocumentPart.Document.Save() 似乎没有保存在 .Net 5 Core
- rdp - 远程桌面变成远程桌面
- android - KMM:如何将共享模块引用到现有的 iOS 项目中
- python - 将 Matplotlib 动画图嵌入 Tkinter
- firebase - 为 Firebase 设置正则表达式重置密码
- angular - 如何使用 ngx-labs/firestore 检索子集合
- php - 我需要基于 php 表单中的输入的特定输出
- prolog - 为什么列表 [1] 不包含在答案 P = [[]] 中?序言
- r - 将具有 X 个唯一值的列解析为 X 个新列,并填充来自另一列 R 的值
- safari - 使用 applescript 在 Safari 的私人窗口中打开一个新选项卡