On Dec 1, 2010, at 1:47 PM, David Coburn wrote:
> I have a string returned in WebSphere Jython formated like:
> [[name [nameInfo from ldap]] [accesssID [accessID info]] ]
> Hopefully, I could convert this to a list of lists, but am having zero
> luck. I have tried casting it with list(), but other than changing
> the output of type() I see no impact:
> convertedListVariable = '['
> convertedListVariable = ' ['
> convertedListVariable = 'n'
> and so on.
> Is there a better way to do this short of parsing the output manually?
> I need to get the name and accessID info as discrete values, whether
> that be a list, dict, or something else.
The string format doesn't appear to be valid python, so you'll have to parse it manually. You'll probably want to use the re module for this.
If it were valid python you could use eval() on it, though that may pose security concerns.