title: Multiple if _name_ in python
body: <p>I'd like to write a code that execute a function into two following categories:</p>
  
  <ol>
  <li>Single file</li>
  <li>Multiple files</li>
  </ol>
  
  <p>What's the construct to do it? I'm thinking with multiple <code>if _name__</code>.</p>
  
  <pre><code>#!/usr/bin/env python
  
  def main(filename)
      # do something with one file.
  
  if __name__ = '__main__'
     single_filename = "file.txt"
     main(single_filename)
  
  # if _name__ ??
  # multiple_files = ['file1.txt', 'file2.txt']
  # for file in multiple files:
  #    main(file)
  </code></pre>
  
  <p>Later I'd use <code>argparse</code> to allow user to decide whether they want to run on single file or multiple files. </p>