title: possible to streamline stdout and stdin communication
body: <p>I been learning about interprocess communication between java and python.</p>
  
  <p>I am trying out some new codes but its not working as expected.</p>
  
  <p>In java class</p>
  
  <p>I have a method that prints </p>
  
  <p><strong>Java</strong> </p>
  
  <pre><code>public static main void (String[] args)
  {
      System.out.println("this is iteration 1");
      System.out.println("this is iteration 2");
      System.out.println("this is iteration 3");
      System.out.println("this is iteration 4");
  }
  </code></pre>
  
  <p><strong>Python</strong> </p>
  
  <pre><code>import sys 
  while True:
      data = sys.readline()
      print "in python " + data
  </code></pre>
  
  <p><strong>Desired output</strong> </p>
  
  <pre><code>In python : this is iteration 1
  In python : this is iteration 2
  In python : this is iteration 3
  In python : this is iteration 4
  </code></pre>
  
  <p><strong>Current output</strong> </p>
  
  <pre><code>In python: this is iteration 1this is iteration 2this is iteration 3this is iteration 4
  []
  []
  []
  []
  </code></pre>
  
  <p><strong>New problem</strong>
  However, my data = sys.stdin.readline() is not blocking. Supposedly, i do not know the number of lines my stdout would have. How would i be able to allow the stdin.readline() to be blocking after the first iteration as i cannot find a method to flush the buffer of the stdin. </p>