title: Returning python list to Java
body: <p>I have a Java application which calls some Python code. I have some problem in understanding how returning lists from Python to java.</p>
  
  <p>Let's assume I have a very simple python module as follow:</p>
  
  <pre><code>def myFunc(param):
      print param
      return [ ["a","b"] , ["c","d"] , ["e","f"] ]
  </code></pre>
  
  <p>And a java piece of code that call this function:</p>
  
  <pre><code>String funcName = "myFunc";
  try {
      PythonInterpreter interpreter = new PythonInterpreter();
      interpreter.exec("from myModule import * \n");
      PyObject someFunc = interpreter.get(funcName);
      someFunc.__call__(new PyString(workspacePath),new PyString(deployName));
  }
  catch(Exception e){
      e.printStackTrace();
      throw new Exception("Error while generating client resources.", e);
  }
  </code></pre>
  
  <p>How can I transform the returned object to something that i can easily iterate over? How can I extract the string which are present in the list?</p>
  
  <p>I tried messing around a bit with PyList or Iterable PyObject but with no success so far. Any idea?</p>
  
  <p>Thanks</p>