What does the python optional parameter refer to
This article mainly shows you "what python optional parameters refer to", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "what python optional parameters refer to" this article.
1. Add one or two bid-winning parameters to the add_argument as optional parameters. Eg:'-v' or'- version'.
If-v and-version exist at the same time, the user can use any method to transfer parameters.
Action='store_true'
2. When you get the parameters, you can only use args.version to get the corresponding values.
When using command-line parameters, we usually do not need to transfer some parameters, such as the simplest ls-l.
But if you do this, the system will report an error.
Parser.add_argument ('- vested,'--version', action='store_true', help= "get version")
You just need to assign action to store_true, which is fine.
The above is all the contents of the article "what do the optional parameters of python refer to". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!