title: How to redirect input to python script
body: <p>How come this command <code>python test.py &lt;(cat file1.txt)</code> does not work accordingly.  I could've sworn I had this working previously.  Basically, I would like to get the output of that <code>cat</code> command as an input to the python script.</p>
  <p>This command</p>
  <pre><code>cat file1.txt | python test.py
  </code></pre>
  <p>works okay, which outputs:</p>
  <pre><code>reading:  file11
  reading:  file12
  </code></pre>
  <p>Which are based on the following scripts/files below.</p>
  <p>The reason I want this to work is because I really want to feed in 2 input files like</p>
  <pre><code>python test.py &lt;(cat file1.txt) &lt;(cat file2.txt)
  </code></pre>
  <p>And would like some python output like:</p>
  <pre><code>reading:  file11 file21
  reading:  file12 file22
  </code></pre>
  <p>I know this is a very simple example, and I can just read in or <code>open()</code> both files inside the python script and iterate accordingly.  This is a simplified version of my current screnario, the <code>cat</code> command is technically another executable doing other things, so its not as easy as just reading/opening the file to read.</p>
  <p>Sample script/files:</p>
  <p>test.py:</p>
  <pre><code>import sys
  
  for line in sys.stdin:
     print(&quot;reading: &quot;, line.strip())
  
  sys.stdin.close()
  </code></pre>
  <p>file1.txt:</p>
  <pre><code>file11
  file12
  </code></pre>
  <p>file2.txt:</p>
  <pre><code>file21
  file22
  </code></pre>