Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
要从 shell 编译 python 文件,可以键入
python -O filename.py
在有很多文件的情况下,这可能是一项任务。如何使用此命令或任何其他命令一次编译文件夹中的所有 .py 文件。
根据 Python 在这方面的编写方式,
python -O *.py
可能就足够了。除此以外
for /f in %x in (*.py) do python -O "%x"