Using nested lists and tables

Iain King iainking at gmail.com
Thu Oct 28 09:35:06 EDT 2010


On Oct 28, 2:19 pm, Zeynel <azeyn... at gmail.com> wrote:
> On Oct 28, 4:49 am, Peter Otten <__pete... at web.de> wrote:
>
> Thank you this is great; but I don't know how to modify this code so
> that when the user types the string 's' on the form in the app he sees
> what he is typing. So, this will be in GAE. But I have a couple of
> other questions, for learning purposes. Thanks again, for the help.
>
> > ...     if columns and columns[-1][0] == s:
>
> Here, how do you compare "columns" (a list?) and columns[-1][0] (an
> item in a list)?
>

It's equivalent to:

if columns:
    if columns[-1][0] == s:
        dostuff()

i.e. check columns is not empty and then check if the last item
startswith 's'.

(a) I don't know if the order of resolution is predicated left-to-
right in the language spec of if it's an implementation detail
(b) columns[-1].startswith('s') would be better

Iain



More information about the Python-list mailing list