renjie ge
renjie ge

Reputation: 174

How to save python --version stdout to a text file?

I have tried the command below in both windows and mac:

python --version > file.txt

which will create a text file but the file it creates is empty.

Upvotes: 1

Views: 611

Answers (1)

Lev M.
Lev M.

Reputation: 6269

python --version outputs to stderr not stdout so to capture it to file use this command:

python --version 2>file.txt

Upvotes: 1

Related Questions