从命令行运行 Python 文件时,可以使用 python3 <file>
,但 VSCode Code Runner 使用 python3 -u <file>
(默认情况下),所以我想知道:
- 有什么区别(因为测试后我没有看到任何可见的 不同之处)?
- 什么是
-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/