code_junkie

Passing arguments with DOS wildcards to a Python script

Nov 13th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. c:data> python myscript.py *.csv
  2.  
  3. from glob import glob
  4. filelist = glob('*.csv') #You can pass the sys.argv argument
  5.  
  6. import glob, sys
  7.  
  8. for arg in glob.glob(sys.argv[1]):
  9. print "Arg:", arg
Add Comment
Please, Sign In to add comment