Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50799
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <sol2ray@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:: [': 0.04; 'json': 0.07; 'subject:ANN': 0.07; 'obj': 0.09; 'objects:': 0.09; 'clark': 0.16; 'dashes': 0.16; 'skip:j 60': 0.16; 'to:name:python list': 0.16; 'yaml': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'print': 0.22; '>>>': 0.24; 'processor': 0.24; 'skip:{ 20': 0.24; 'looks': 0.24; '---': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'doc': 0.31; 'url:python': 0.33; 'third': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'add': 0.35; '8bit%:9': 0.36; 'url:listinfo': 0.36; "didn't": 0.36; 'method': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'handle': 0.38; 'to:addr :python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; 'url:mail': 0.40; 'more': 0.64; 'between': 0.67; 'useful.': 0.68; 'jul': 0.74; 'processor.': 0.84; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wkKI2sOo9XgiX250ISt3lHNbT+hy1tVIGUljP7HyOMU=; b=Sxmy4TlDi0eLgp6dMLRychIK+oGZ+5iuUnW6yQHMzvuk+RGL7f4ieCuSU7zQShMKqm Ig/Brj2KXxL66Lvcd+OyqxxDbdmkguOdi1EcNtqNuV3aSkr+eIGJjoS6Wty50lb595ot 1MwF0GXn6NaqiyIYG6LUbDmpcK76gWm3M4hgtmadWGddYP32+k13IcELO545G/m/C3lC wwzT4ZCJjuHh9IPVC17s1CrwM7+ZHpF2xqvjLtI8llfqidZhiF1yjz/l9RG/fyv7rEkZ omqWgdelCGaRUTme1Y2pTWRxrvEIxmf0TvfTONlv9G3sNs3ahI9n450YUWVhOiGK6FQr wIMw== |
| MIME-Version | 1.0 |
| X-Received | by 10.68.217.170 with SMTP id oz10mr8397225pbc.152.1374089758559; Wed, 17 Jul 2013 12:35:58 -0700 (PDT) |
| In-Reply-To | <1374076300.20300.140661256765729.2467B0A8@webmail.messagingengine.com> |
| References | <CACGSewf0J3SPNssM-iJPg1Rthj+_wJe1p-fGe4_FcgxHGiJu0A@mail.gmail.com> <1374076300.20300.140661256765729.2467B0A8@webmail.messagingengine.com> |
| Date | Wed, 17 Jul 2013 15:35:58 -0400 |
| Subject | Re: [ANN]:JSONStream |
| From | Sol Toure <sol2ray@gmail.com> |
| To | Python List <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=047d7b2ed9b3f2f02404e1ba3368 |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4809.1374089767.3114.python-list@python.org> (permalink) |
| Lines | 102 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1374089767 news.xs4all.nl 15941 [2001:888:2000:d::a6]:42119 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:50799 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
I didn't look into using YAML processor.
Also that would have required pre-processing the data to add the separators.
With this method you don't need the separators. You can have 0 or more
white space between objects:
for obj in JSONStream(StringIO('''{"one":1}{"two":2} {"three":3} 4
{"five": 5}''')):
print(obj)
{"one":1}
{"two":2}
{"three":3}
4
{"five":5}
It solved my problem, so I thought someone might find it useful.
On Wed, Jul 17, 2013 at 11:51 AM, Clark C. Evans <cce@clarkevans.com> wrote:
> **
> Looks interesting. In YAML we used three dashes as the "stream separator".
> So already a YAML processor could handle a JSON stream ...
>
> >>> for doc in yaml.load_all("""
> ... --- {"one": "value"}
> ... --- {"two": "another"}
> ... ---
> ... {"three": "a third item in the stream",
> ... "with": "more data"}
> ... """):
> ... print doc
> ...
> {'one': 'value'}
> {'two': 'another'}
> {'with': 'more data', 'three': 'a third item in the stream'}
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [ANN]:JSONStream Sol Toure <sol2ray@gmail.com> - 2013-07-17 15:35 -0400
csiph-web