简体   繁体   中英

How to pass file contents to a python script on windows

I would like to pass the contents of a file along with some other parameters to a python script on windows.

On linux, I can do it like this:

less input.txt | my_script.py  > output.txt

On windows I tried the following but it doesn't seem to work:

more input.txt | python my_script.py  > output.txt

Any idea what I'm doing wrong?

Use following command. It works both in Linux and Windows.

python my_script.py < input.txt > output.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM