[Tutor] populating an array or using a dictionary

Alan Gauld alan.gauld at btinternet.com
Sun Oct 21 20:59:51 CEST 2007

"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.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list