[Tutor] If/elif/else when a list is empty

James Mills prologic at shortcircuit.net.au
Tue Sep 14 06:09:59 CEST 2010

On Tue, Sep 14, 2010 at 1:58 PM,  <aeneas24 at priest.com> wrote:
> rgenre = re.split(r';', rf.info["genre"]) # When movies have genre

First question. Why are you not using an XML parser (it looks like
your IMDB data files _are_ XML). e.g: elementree (in the standard

>    else len(rgenre)<1: # I was hoping this would take care of the "there is
> no genre information" scenario but it doesn't
>            rg1=rg2=rg3="NA"

the "else" statement does not expect (nor accept) an expression after
it, just write:



-- James Mills
-- "Problems are solved by method"

More information about the Tutor mailing list