Send array back in result from urllib2.urlopen(request, postData)
vanommen.robert at gmail.com
vanommen.robert at gmail.com
Fri Jan 10 15:57:59 EST 2014
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.
Thanks in advance for the kind reactions!
Greetings Robert.
More information about the Python-list
mailing list