Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60109

Re: parsing RSS XML feed for item value

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <thudfoo@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.093
X-Spam-Evidence '*H*': 0.84; '*S*': 0.02; 'label,': 0.09; 'subject:parsing': 0.09; 'python': 0.11; '0.6': 0.16; 'subject:XML': 0.16; 'subject:item': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'wednesday': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; "skip:' 10": 0.31; 'extract': 0.31; 'larry': 0.31; 'sep': 0.31; 'linux': 0.33; 'received:google.com': 0.35; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'content-disposition:inline': 0.62; 'header:Message-Id:1': 0.63; 'more': 0.64; 'humidity': 0.84; 'temperature': 0.84; 'wilson': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:references:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :message-id; bh=H3XKToBxUAW+oXBM7xfgOO84ivMyQct7628nVKm7z0g=; b=LjoqM08A6neMPS6/JSCtz9fVtnDs59WtOQht32Oy59UBgFnQMdUgydcMYwviYKWco/ rOipNW17or9Jt1yMNMM0vj8LM71K5pZfhicbihx36oJF9gG5OouWD4HmQveNdk73YMOd qAseb4Ug57Z5sYkOrJbMbB5VKW2tRzOY43ygXy+TxtJgSEixLb/r1FYpNEZwNAmJxOaV 9K8dcYbmj2u7jCs8v5PNUPMUEgePHZsgG2an8Sk8bSxG2j2vIMIDFn97WyQfp7MGnAQc a0aAR09v5GxRe6YDQ9XaZuKRo5h0ZxOkB+Gb6X0CjiBrUbo/fVmAMVjr5us5UGpoDDmu MK5g==
X-Received by 10.68.225.9 with SMTP id rg9mr1627751pbc.122.1384965080846; Wed, 20 Nov 2013 08:31:20 -0800 (PST)
From xDog Walker <thudfoo@gmail.com>
To python-list@python.org
Subject Re: parsing RSS XML feed for item value
Date Wed, 20 Nov 2013 08:31:08 -0800
User-Agent KMail/1.9.5
References <bcd7481a-45c2-4dbb-a9e3-c5faa80ac899@googlegroups.com> <e3614644-c3fe-46e6-b5f1-7f285f1e81b1@googlegroups.com>
In-Reply-To <e3614644-c3fe-46e6-b5f1-7f285f1e81b1@googlegroups.com>
MIME-Version 1.0
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding 7bit
Content-Disposition inline
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.2976.1384965090.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384965090 news.xs4all.nl 15920 [2001:888:2000:d::a6]:59606
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60109

Show key headers only | View raw


On Wednesday 2013 November 20 05:44, Larry Wilson wrote:
> >>> feed.entries[0].w_current
>
> {'temperature': u'20.3', 'dewpoint': u'18.6', 'windgusts': u'29.6', 'rain':
> u'0.6', 'humidity': u'90', 'pressure': u'0.0', 'windspeed': u'22.2',
> 'winddirection': u'SSW'}
>
>
> in the above I get the subitem as shown. How do I extract the label, values
> pairs?

Python 3.3.0 (default, Sep 30 2012, 09:02:56)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> w_current = {'temperature': u'20.3', 'dewpoint': u'18.6', 'windgusts': 
u'29.6', 'rain': u'0.6', 'humidity': u'90', 'pressure': u'0.0', 'windspeed': 
u'22.2', 'winddirection': u'SSW'}
>>> for label, value in w_current.items():
...    print (label, value)
...
dewpoint 18.6
temperature 20.3
rain 0.6
pressure 0.0
windspeed 22.2
humidity 90
winddirection SSW
windgusts 29.6
>>>
-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

parsing RSS XML feed for item value Larry Wilson <itdlw1@gmail.com> - 2013-11-19 19:39 -0800
  Re: parsing RSS XML feed for item value xDog Walker <thudfoo@gmail.com> - 2013-11-19 20:06 -0800
  Re: parsing RSS XML feed for item value Larry Wilson <itdlw1@gmail.com> - 2013-11-20 05:44 -0800
    Fwd: parsing RSS XML feed for item value Neil Cerutti <mr.cerutti@gmail.com> - 2013-11-20 09:48 -0500
    Re: parsing RSS XML feed for item value xDog Walker <thudfoo@gmail.com> - 2013-11-20 08:17 -0800
    Re: parsing RSS XML feed for item value xDog Walker <thudfoo@gmail.com> - 2013-11-20 08:31 -0800
  Re: parsing RSS XML feed for item value Larry Wilson <itdlw1@gmail.com> - 2013-11-20 15:44 -0800

csiph-web