title
this is my blog
分享、记录生活
this is my blog
VS Code 控制台输出中文乱码的问题
主要是需要强制终端和 Python 环境变量都使用 UTF-8 (65001) 编码。
把下面这段配置加入到 settings.json 中即可:
```json {
"terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "icon": "terminal-powershell", "args": ["-NoExit", "-Command", "chcp 65001 >$null"] }, "Command Prompt": { "path": [ "${env:windir}\\Sysnative\\cmd.exe", "${env:windir}\\System32\\cmd.exe" ], "args": [], "icon": "terminal-cmd" }, "Git Bash": { "source": …
这段 Python 代码因为有 input() 导致你在后台运行时报 EOFError 并且乱码。请你帮我修改这段代码,去掉 input(),改为使用 sys.argv 或 argparse 从命令行接收参数 (1 或 2),并在顶部声明 # -- coding: utf-8 -- 解决乱码。
aaaa