title: Python pass multiple strings to a single command line argument
body: <p>I am new to Python and barely know about lists and tuples. I have a program to execute which takes several values as input argument. Below is the list of input args</p>
  
  <pre><code>parser = argparse.ArgumentParser()
  parser.add_argument("server")
  parser.add_argument("outdir")
  parser.add_argument("dir_remove", help="Directory prefix to remove")
  parser.add_argument("dir_prefix", help="Directory prefix to prefix")
  parser.add_argument("infile", default=[], action="append")
  options = parser.parse_args()
  </code></pre>
  
  <p>The program works fine with the following command</p>
  
  <pre><code>python prod2dev.py mysrv results D:\Automations D:\MyProduction Automation_PP_CVM.xml
  </code></pre>
  
  <p>But looking at the code, it seems like the code can accept multiple file names for argument "infile". I have tried following to pass multiple file names but none worked.</p>
  
  <pre><code>python prod2dev.py mysrv results D:\Automations D:\MyProduction "Automation_PP_CVM.xml, Automation_PT_CVM.xml"
  
  python prod2dev.py mysrv results D:\Automations D:\MyProduction ["Automation_PP_CVM.xml", "Automation_PT_CVM.xml"]
  
  python prod2dev.py mysrv results D:\Automations D:\MyProduction ['Automation_PP_CVM.xml', 'Automation_PT_CVM.xml']
  
  python prod2dev.py mysrv results D:\Automations D:\MyProduction ['"Automation_PP_CVM.xml"', '"Automation_PT_CVM.xml"']
  </code></pre>
  
  <p>The code below is apparently traversing the list</p>
  
  <pre><code>infile = windowsSucksExpandWildcards(options.infile)
   for filename in infile:
      print(filename)
      outfilename = os.path.join(options.outdir, os.path.split(filename)[1])
      if os.path.exists(outfilename):
          raise ValueError("output file exists: {}".format(outfilename))
  
      with open(filename, "rb") as f:
          root = lxml.etree.parse(f)
      if not isEnabled(root):
          print("Disabled. Skipping.")
          continue
      elif not hasEnabledTriggers(root):
          print("Has no triggers")
          continue
  ...
  ...
  ...
  def windowsSucksExpandWildcards(infile):
      result = []
      for f in infile:
          tmp = glob.glob(f)
          if bool(tmp):
              result.extend(tmp)
          else:
              result.append(f)
      return result
  </code></pre>
  
  <p>Please guide on how to pass multiple filenames (strings) to a single argument "infile" which is apparently a list.</p>
  
  <p>I'm running Python 3.5.1 |Anaconda 4.0.0 (32-bit)</p>