Answer the question
In order to leave comments, you need to log in
How to pass 2 files to the script as an argument in the console?
The task is this - there are 2 cvs files. You need to write a python script that, using pandas, will join these tables by matching id in both tables and filter by certain fields.
cvs files will be different every time.
The interface is like this. Run the script in the console $python script.py имя.файла1 имя.файла2
After that, the script performs the merging and filtering.
Tell me how to pass files as arguments to the script, as well as how to merge tables. I am new to python.
Thank you.
Answer the question
In order to leave comments, you need to log in
Well, you've already passed the filenames to the script as arguments. It remains to learn to accept them.
import sys
print(sys.argv)
sys.argv
- a list of passed arguments, with the first being the name of the executable script itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question