On 2014-01-10 20:57, vanommen.rob...@gmail.com wrote:
Hello,
I have a Raspberry Pi with 10 temperature sensors. I send the data from the
sensors and some other values with json encoding and:
result = urllib2.urlopen(request, postData)
to a online PHP script wich places the data in a mysql database.
In the result:
result.read()
i am trying to send data back from the PHP to the RPI. I make an array in PHP
$para[0] = $REGELING_ORG;
$para[1] = $VLVERWL_ORG;
$para[2] = $VLOERVRAAG_ORG;
$para[3] = $TIJDVLOER_ORG;
$para[4] = $SETPOINT_ORG;
echo $para;
In python when i do
para = result.read()
print para
the output is:
[null,null,null,null,null,"J"]
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?
And why is para[5] not "J" but , ?
How can I change the data back to an array? I've tried with json, but that
doesn't change anything.
[snip]
What exactly do you mean by "json doesn't change anything"? I get this:
>>> para = '[null,null,null,null,null,"J"]'
>>> print para
[null,null,null,null,null,"J"]
>>> import json
>>> print json.loads(para)
[None, None, None, None, None, u'J']
--
https://mail.python.org/mailman/listinfo/python-list