gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 20:07:30 26 4
gpt4 key购买 nike

从命令行运行 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/

26 4 0