title: Is there a way to run python code using the output from stdout or a redirection?
body: <p>Suppose I have a an output from a command like this:</p>
  
  <pre><code>C:\&gt; head type_test.py
  def greeting(name: str) -&gt; str:
      return 'Hello ' + name
  
  print(greeting("John"))
  print("foo")
  print("bar")
  
  C:\&gt; head type_test.py 6
  def greeting(name: str) -&gt; str:
      return 'Hello ' + name
  
  print(greeting("John"))
  print("foo")
  </code></pre>
  
  <p>And I want to redirect the code to the python interpreter somehow so the output would be:</p>
  
  <pre><code>C:\&gt; ???
  Hello John
  foo
  </code></pre>
  
  <p>I know that I have to redirect the output from the previous command to python, but does python run script when provided directly like this?</p>