indentation messing up my tuple?
localpricemaps at gmail.com
localpricemaps at gmail.com
Wed Feb 1 14:08:27 EST 2006
i am using a tuple because i am building lists. if i just use (food +
drink) then while drink is unique food remains the same do i get this:
(burger, coke)
(burger, 7up)
(burger, sprite)
infidel wrote:
> tuple is the name of the built-in type, so it's not a very good idea to
> reassign it to something else.
>
> (food + drink + '\n') is not a tuple, (food + drink + '\n',) is
>
> There's no reason to use tuples here, just do this:
>
> data.append(food + drink)
> f.write('\n'.join(data))
More information about the Python-list
mailing list