[Plone-IT] beautifulsoup

Vito Falco vitofalco a gmail.com
Ven 2 Apr 2010 08:02:00 UTC


temperatura python:context.estrai_dati_meteo[0] ? :-D

Se è il primo elemento della lista, allora il suo indice è "0" e non "1"

Vito

Il giorno 02 aprile 2010 09.59, Fabrizio Rota <fabrizio.rota a gmail.com> ha
scritto:

> Con i vostri consigli e beautifulsoup ho scritto un external method che
> estrae da un pagina alcuni dati meteo.
> L'external method si chiama estrai_dati_meteo.
> Il risultato dello script dell'external method è una lista di dati meteo
> (!) come questa:
>
> [6.1 °C, 50 %, 1022.0 mbar, Est 112° 0.0 m/s (Raffiche 0.0 m/s), 0.0 mm
> Ultima ora, 2.5 mm Ultime 24 ore]
>
> Proprio ciò che mi serviva!
>
> Ora, sto scrivendo un page template che estrae alcuni dati da questa lista
> e li impagina opportunamente.
> Il problema è che se estraggo per esempio il primo elemento con il codice:
>
> <tal:block define="temperatura python:context.estrai_dati_meteo[1]">
> <span tal:replace="temperatura">adfadfa</span>
>
> ottengo un bel
>
> Exception TypeAttributeErrorException Value__getitem__
>
> Qualche idea su come risolvere? La lista sembra così pulita.... perchè non
> tira fuori gli elementi?
>
> --
> Faber
> --------------------
> "Life is what happens to you while you're busy making other plans" - J.
> Lennon
>
> _______________________________________________
> Plone-IT mailing list
> Plone-IT a lists.plone.org
> http://lists.plone.org/mailman/listinfo/plone-it
> http://www.nabble.com/Plone---Italy-f21728.html
>



-- 
http://appuntiplone.wordpress.com (IT) - http://notasdeplone.wordpress.com(ES)
"Design is the method of putting form and content together. Design, just as
art, has multiple definitions; there is no single definition. Design can be
art. Design can be aesthetics. Design is so simple, that's why it is so
complicated." by Paul Rand
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.plone.org/pipermail/plone-plone-it/attachments/20100402/3eae5d87/attachment.html>


Maggiori informazioni sulla lista Plone-IT