Is it possible to pass arguments to a python made exe at runtime?

前端 未结 4 811
终归单人心
终归单人心 2021-02-14 07:34

I\'m experimenting with file I/O. I have a small practice program that creates a text file when run. I packaged it with pyinstaller so that double clicking on the exe creates a

4条回答
  •  借酒劲吻你
    2021-02-14 07:56

    What you are looking for is something like the python argparse module

    Or you can read the values directly using sys.argv

    import sys
    sys.argv[0] # the name of the command that was called
    sys.argv[1] # the first argument, eg '--dev'
    sys.argv[2] # the second...
    

提交回复
热议问题