Python argv taking wild card path

后端 未结 2 1326
花落未央
花落未央 2021-01-20 14:33

I run my script with doc1/*.png as first argument, but it gets converted to doc1/image1.png.

How can I let Python see the exact argument?<

2条回答
  •  醉话见心
    2021-01-20 15:23

    As @Jean-François Fabre sais, it is possible to use wildcards on windows using glob module.

    import glob
    paths = glob.glob('C:\path\with\wildcard.*')
    

提交回复
热议问题