Search code examples
javapythonarraysjythonjython-2.5

Jython - Convert Java array with Java Strings to Python list with Python strings


I'm using some Oracle API with Jython2.5. Once of the methods returns:

array(java.lang.String)

I would like to convert this to a python list, with strings as the elements in the list. e.g.

['some', 'strings']

I'm not sure how to do this, or if there's a simple method in the java.lang or java.utils library I can use for the conversion.

EDIT: https://docs.oracle.com/cd/E10530_01/doc/epm.931/html_security_api/javadoc/com/hyperion/css/common/CSSGroupIF.html

method GetGroupLists()


Solution

  • You may use "tolist" on an array to convert it to a list:

    grouplist = GetGroupList().tolist()