Python stdin filename

后端 未结 4 674
难免孤独
难免孤独 2020-12-19 05:21

I\'m trying to get the filename thats given in the command line. For example:

python3 ritwc.py < DarkAndStormyNight.txt

I\'m

4条回答
  •  天命终不由人
    2020-12-19 05:59

    I don't think it's possible. As far as your python script is concerned it's writing to stdout. The fact that you are capturing what is written to stdout and writing it to file in your shell has nothing to do with the python script.

提交回复
热议问题