Sequence of empty lists

J

JP. Baker

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
 
P

Peter Hansen

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,221
Messages
2,571,133
Members
47,747
Latest member
swapote

Latest Threads

Top