October 19, 2024

Code

if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(
        description='What this program is going to do.'
    )
    parser.add_argument(
        '--image_list', '-IL', nargs="*", type=str, default=[], help='path for image1'
    )
    args = parser.parse_args()

you can use nargs=”+” instead of nargs=”*”, in that case, more than an argument is required for that.

Call the script from Command line

python3 main.py --image_list image1.jpg image2.jpg image3.jpg