Sequence of empty lists

JP. Baker ccjpb at shark.cse.bris.ac.uk
Tue Feb 22 07:38:12 EST 2005


I give up (and have prepared myself for replies telling
me which search strings to use on Google etc)!

How *should* I create a sequence of N empty lists (buckets)?

I obviously can't use

a = [[]]*N

and I have found various solutions and am currently using

a = map(lambda x: [], range(N))

but can't help feeling that I have missed something obvious.

nhoJ
-- 
John P Baker



More information about the Python-list mailing list