Voici mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
import argparse
 
parser = argparse.ArgumentParser()
 
parser.add_argument("required_arg", metavar="username:pass@hostname")
parser.add_argument("--optional_arg", 
                    help="This optional argument should have args and 
                          kwargs implemented in it as I want to make 
                          it flexible eg.
                          it may have optional_arg1, 
                          optional_arg2, key1=value1, key2=value2 or 
                          it may have optional_arg1, key1=value1, 
                          key2=value2, key3=value3")
Quelqu'un peut-il s'il vous plaît me montrer comment implémenter *args et **kwargs dans cette section add_argument() ?