Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63675
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'encoding': 0.05; 'output': 0.05; 'json': 0.07; 'none,': 0.07; 'mysql.': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; '[none,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'json,': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'skip:[ 30': 0.16; 'subject:array': 0.16; 'subject:skip:u 10': 0.16; 'wrote:': 0.18; 'trying': 0.19; "skip:' 30": 0.19; 'subject:request': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'script': 0.25; 'this:': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'correct': 0.29; 'array': 0.29; 'character': 0.29; "doesn't": 0.30; 'subject:from': 0.34; 'skip:u 20': 0.35; 'received:84': 0.35; 'but': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'according': 0.40; 'how': 0.40; 'subject:back': 0.60; 'back': 0.62; 'email addr:gmail.com': 0.63; 'places': 0.64; 'anything.': 0.68; 'online': 0.71; 'skip:$ 10': 0.81; '"j"': 0.84; 'sfxlen:4': 0.84; 'subject:Send': 0.84; 'temperature': 0.84; 'pfxlen:big': 0.91; 'sensors': 0.91 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=dYa5gxne c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=5FYZ9MsUIQAA:10 a=4lhncG02jy8A:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=C_5M5SnrfeoA:10 a=pGLkceISAAAA:8 a=LaJSGqsr8Xh-xXrakL8A:9 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Sat, 11 Jan 2014 00:23:49 +0000 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| CC | python-list@python.org |
| Subject | Re: Send array back in result from urllib2.urlopen(request, postData) |
| References | <aae37903-e5ab-41c5-87a7-2e3e78444878@googlegroups.com> |
| In-Reply-To | <aae37903-e5ab-41c5-87a7-2e3e78444878@googlegroups.com> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5312.1389399830.18130.python-list@python.org> (permalink) |
| Lines | 58 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389399830 news.xs4all.nl 2919 [2001:888:2000:d::a6]:40190 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63675 |
Show key headers only | View raw
On 2014-01-10 20:57, vanommen.robert@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']
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Send array back in result from urllib2.urlopen(request, postData) vanommen.robert@gmail.com - 2014-01-10 12:57 -0800 Re: Send array back in result from urllib2.urlopen(request, postData) John Gordon <gordon@panix.com> - 2014-01-10 22:53 +0000 Re: Send array back in result from urllib2.urlopen(request, postData) Dave Angel <davea@davea.name> - 2014-01-10 18:12 -0500 Re: Send array back in result from urllib2.urlopen(request, postData) Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-10 23:56 +0000 Re: Send array back in result from urllib2.urlopen(request, postData) MRAB <python@mrabarnett.plus.com> - 2014-01-11 00:23 +0000 Re: Send array back in result from urllib2.urlopen(request, postData) vanommen.robert@gmail.com - 2014-01-11 01:31 -0800
csiph-web