Python vs代码输出编码
我键入了一个测试bs4的简单代码,如下所示Python vs代码输出编码,python,visual-studio-code,Python,Visual Studio Code,我键入了一个测试bs4的简单代码,如下所示 # -*- coding: utf-8 -*- import bs4 import requests page_url = 'http://www.naver.com' response = requests.get(page_url) soup = bs4.BeautifulSoup(response.text) print(type(soup)) print (soup.prettify()[0:1000]) 若你们检查一个正在添加的图像
# -*- coding: utf-8 -*-
import bs4
import requests
page_url = 'http://www.naver.com'
response = requests.get(page_url)
soup = bs4.BeautifulSoup(response.text)
print(type(soup))
print (soup.prettify()[0:1000])
若你们检查一个正在添加的图像文件,你们可以在输出窗口中看到破碎的韩文字母。我怎样才能解决这个问题?多谢各位
我不知道这对你是否有帮助。这是一个task.json文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "python",
"isShellCommand": true,
"args": ["${file}"],
"showOutput": "always",
}
谢谢你的回答,橙子
{
// Controls after how many characters the editor will wrap to the next line. Setting this to 0 turns on viewport width wrapping (word wrapping). Setting this to -1 forces the editor to never wrap.
"editor.wrappingColumn": 0, // default value is 300
// Controls the font family.
"editor.fontFamily": "Consolas, 'Malgun Gothic', '맑은 고딕','Courier New', monospace",
// Controls the font size.
"editor.fontSize": 15,
}
VisualStudio代码的默认字体摩纳哥(Monaco)似乎不包含韩语字符(在屏幕上查看其字符时),这可能是您获得这些“未知字符”符号的原因。也许可以尝试找到一种包含韩语符号的字体,并将Visual Studio代码字体更改为该字体。虽然不是单间距,
Malgun Gothic
包含韩文字符,而且是免费的,甚至包括在一些Windows版本中(虽然不是我的Windows 10,显然它包含在Vista中)。谢谢。我添加了我的setting.json配置。