Extracting elements over multiple lists?

John Gordon gordon at panix.com
Mon Nov 7 12:37:27 EST 2011


In <b9e53a75-7490-4b6a-844a-20cfce263939 at a12g2000vbz.googlegroups.com> JoeM <josephmeiring at gmail.com> writes:

> a=[1,2,3,4,5]
> b=["one", "two", "three", "four", "five"]
> c=["cat", "dog", "parrot", "clam", "ferret"]

> what is the most pythonic method of removing the first element from
> all of the lists?

for arr in [a,b,c]:
  arr.pop(0)

-- 
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