Python argv taking wild card path

Viewed 1727

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?

img_list = []
print sys.argv[1]
x = sys.argv[1]
img_list = [img for img in glob.glob(x)]
2 Answers

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.*')
Related