I'm sure this is a common question but I'm such a python newbie I don't know how to search for the question.
I have a script with a function like so:
firstarg = sys.argv[1]
secondarg = sys.argv[2]
def examplefunc(firstarg):
#does something
#returns something
def example2(firstarg, secondarg):
#also does something and returns something
I have a folder with a huge number of txt files. For the first example function I want to cycle through all these txt files and print out the answer in to one new file (i.e. pass in each txt file as firstarg). Similarly for the second function I want to fix the first argument as one particular txt file and for the second argument cycle through all remaining txt files.
The only way I know how to run python commands with arguments like this would be to run in my terminal something of the form:
python myscript.py ./txtfile1 ./txtfile2
And then change the arguments accordingly. I'm sure there's a better way. Can anyone help?