Why does the insert after list function fail?

John Gordon gordon at panix.com
Thu Sep 22 15:32:37 EDT 2016


In <39ec91a8-eeae-489f-9237-9d9a481a88c5 at googlegroups.com> 380162267qq at gmail.com writes:

> A=["1","2","3"]
> print(list(map(float,A)).insert(0,1))

> I want to insert 1 at the head of the list but this gives me a surprise

insert() does not return anything; it modifies the existing list in-place.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list