Appending to []

Kiuhnm kiuhnm03.4t.yahoo.it
Fri Apr 20 16:19:25 EDT 2012


On 4/20/2012 22:03, Jan Sipke wrote:
> Can you explain why there is a difference between the following two
> statements?
>
>>>> a = []
>>>> a.append(1)
>>>> print a
> [1]
>
>>>> print [].append(1)
> None

Try this one:
     a = []
     print a.append(1)

Does that answer your question?

Kiuhnm



More information about the Python-list mailing list