On Fri, 10 Jan 2014 12:57:59 -0800 (PST), vanommen.rob...@gmail.com wrote:

No idea about the php..

In python when i do

para = result.read()
print para

the output is:
[null,null,null,null,null,"J"]

That's a string that just looks like a list.

This is correct according to the data in PHP from the mysql.


when I do print para[1]

the output is:

n


the seccond character from the data. Why is this not the seccond
datafield?

There are no data fields in a string.
And why is para[5] not "J" but ,   ?

That's character 5 of the string.

How can I change the data back to an array? I've tried with json,
but that doesn't change anything.

You have to parse it. I don't know what rules you used at the php end, but at a guess, I'd start by stripping the brackets, then splitting by comma. Then iterate through each item looking for special cases. Each item consisting of null gets replaced by None, each item starting with quotes gets them stripped, and perhaps anything else is replaced by float (item).

Still questions to ask like whether quoted item can have embedded comma.

--
DaveA

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to