python - "python3 -u"是什么意思?

标签 python command-line

从命令行运行 Python 文件时,可以使用 python3 <file> ,但 VSCode Code Runner 使用 python3 -u <file> (默认情况下),所以我想知道:

  1. 有什么区别(因为测试后我没有看到任何可见的 不同之处)?
  2. 什么是 -u部分称为?

最佳答案

-u 标志,根据 Python 的 --help 语句:

force the binary I/O layers of stdout and stderr to be unbuffered; stdin is always buffered; text I/O layer will be line-buffered; also PYTHONUNBUFFERED=x

这是documented here在 Python 文档中。

这些被称为命令行选项。其中有很多,您可以使用 python3 --help 阅读它们。

关于python - "python3 -u"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54327430/

相关文章:

python - 在 google colab 中运行 python 脚本,nohup 给出 ImportError

python - 根据某些条件(在 Python 中)将字符串(行)添加到特定位置

command-line - 启动 Outlook 并从命令行预先填充电子邮件

command-line - MacVim:使用 `alias mvim="open -a macvim"` 从命令行创建新文件

perl - Perl 开关的代码内检查

command-line - QuickTime 使用 FFMPEG 对可读电影进行编码

python - 我可以拥有一个通用 fixture 并在测试中调用不同的值吗?

python - 有没有办法使用另一个字典在 Python 字典上设置多个默认值?

python - 使用行分隔符转换数据框

c++ - 从 .h 文件生成 .cpp 源