dumb newbie list question

Andrew Dalke dalke at acm.org
Sun Aug 19 20:39:11 CEST 2001

Dan Girellini:
>>Is there an easy way to do this without building a
>>  second list of the right size and concatenating them?

Bernd Nawothnig:
>Why will you do this?
>works fine and should be faster then many l.append('x')

If you don't want to create a new list, you could also do

  l.extend( [None] * (10-len(l)) )

(Using None is closer to the way Perl does it than using 'x'.)


More information about the Python-list mailing list