R
R
rmfalx2017-08-31 16:53:22
linux
rmfalx, 2017-08-31 16:53:22

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

1 answer(s)
A
Anton Kuzmichev, 2017-08-31
@rmfalx

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 question

Ask a Question

731 491 924 answers to any question