我已经开始使用 Python 和 Django,我在这个领域很新。这是我第一次在这里提问……如果有已知的解决方案,我会提前道歉……
当我安装并设置 VSCode 格式化程序“黑色”(将 linter 设置为 flake8 之后)时,教程视频导师的一面会弹出类似“未安装格式化程序 autopep8”的弹出窗口。安装?'。& 我的没有显示该消息。
所以我所做的是...
底部代码来自 settings.json(在 vscode 文件夹中)。
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black", # input manually
"python.linting.flake8Args": ["--max-line-length=88"] # input manually
}
Run Code Online (Sandbox Code Playgroud)
我找到了一个“黑色格式化程序”文档。https://github.com/psf/black & 它说... python -m black {source_file_or_directory} & 我收到以下错误消息。
Usage: __main__.py [OPTIONS] [SRC]...
Try '__main__.py -h' for help.
Error: …Run Code Online (Sandbox Code Playgroud)