[Tutor] a shorter way to write this

jrlen balane nbbalane at gmail.com
Fri Mar 25 20:12:52 CET 2005


ahhhh, so thats the way to do it,  a list comprehension, thanks for the info...


On Fri, 25 Mar 2005 14:10:41 -0500, Gabriel Farrell <gsf at panix.com> wrote:
> how about
> 
> manyones = [ 1 for x in range(96) ]
> 
> 
> On Sat, Mar 26, 2005 at 03:02:34AM +0800, jrlen balane wrote:
> > basically, i'm going to create a list with 96 members but with only one value:
> >
> > list1[1,1,1,1...,1]
> >
> > is there a shorter way to write this one???
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list