Is it possible to run a python script and feed in a file as an argument using <
? For example, my script works as intended using the following command python scriptname.py input.txt
and the following code stuffFile = open(sys.argv[1], 'r')
.
However, what I'm looking to do, if possible, is use this command line syntax: python scriptname.py < input.txt
. Right now, running that command gives me only one argument, so I likely have to adjust my code in my script, but am not sure exactly how.
I have an automated system processing this command, so it needs to be exact. If that's possible with a Python script, I'd greatly appreciate some help!