There are two ways to use command line arguments in a standard library?
sys.argv
of the sys
moduleI wonder if sys.argv
can simply refer to the arguments
Since it is a good idea, I will pick up some reference pages to try to implement it properly. First of all, the official document "Python 3 document"
As a general rule, the following page seems to be a good way to use ʻargparse`
Below, the process of passing a file as an argument with a pipe was written and I wanted to understand the contents, but I did not understand well that it was written one more time ...
Specifically, the following questions
When I use sys.stdin.isatty ()
to determine if there was a standard input ... Is the data received by the standard input included in the first argument?
There is also an execution example, but what is the key to identify the standard input value when getting the standard input value with ʻargparse.ArgumentParser (). parse_args () `...
For the time being, "process of passing a file as an argument by pipe" is not necessary for the most recently required command, so it is temporarily suspended.
The following page is a practical introductory article that describes how to write when you want to start using it quickly and how to use it frequently.
Common usage is ...
It seems that there are some modules that complement the command program other than the standard module
In addition, the following were required during the actual implementation.
Since it seems to be long, for the time being, it is the result of the investigation at the time of basic command creation, so that's all.
Recommended Posts