[英]How to save python --version stdout to a text file?
我在 windows 和 mac 中都嘗試了以下命令:
python --version > file.txt
這將創建一個文本文件,但它創建的文件是空的。
python --version
輸出到stderr
而不是stdout
,因此要將其捕獲到文件中,請使用以下命令:
python --version 2>file.txt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.