[Tutor] populating an array or using a dictionary

Bryan Fodness bryan.fodness at gmail.com
Sun Oct 21 21:49:31 CEST 2007


it works well if it is on the same line, but I would like to wrap it for
readability

On 10/21/07, Bryan Fodness <bryan.fodness at gmail.com> wrote:
>
> it doesn't fix the problem, now it says there is a syntax error on the
> equal sign.
>
> On 10/21/07, Alan Gauld <alan.gauld at btinternet.com> wrote:
> >
> >
> > "Bryan Fodness" <bryan.fodness at gmail.com> wrote in
> >
> > >    d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10,
> > >    fs11, fs12, fs13, fs14, fs15, fs16, fs17, fs18, fs19,
> > >    fs20, fs21, fs22, fs23, fs24, fs25, fs26, fs27, fs28,
> > >    fs29, fs30, fs31, fs32, fs33, fs34, fs35, fs36, fs37,
> > >    fs38, fs39, fs40 = line.split()
> >
> > Because your tuple spans multiple lines I think you
> > will need to put parens round it.
> >
> > >>> a,b,c,d
> > Traceback (most recent call last):
> > File "<input>", line 1, in ?
> > NameError: name 'a' is not defined
> > >>> (a,b,c,d
> > ...
> >
> > So starting with a paren tells Python to ignore the newline.
> > Without it it gets confused about what you want to do.
> >
> > HTH,
> >
> > --
> > Alan Gauld
> > Author of the Learn to Program web site
> > http://www.freenetpages.co.uk/hp/alan.gauld
> >
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071021/d0e341f0/attachment.htm 


More information about the Tutor mailing list