[Tutor] Treating lists as lists

Hugo Arts hugo.yoshi at gmail.com
Wed Nov 30 02:14:40 CET 2011


On Wed, Nov 30, 2011 at 2:09 AM, Mark Lybrand <mlybrand at gmail.com> wrote:
> I am pretty sure I saw this somewhere but now I can't.  Here's the problem:
> list = ['hello', 'world']
> template = '%s %s'
> print template % list
>
> But it appears that list is just one (list) when I want to treat it as two
> (items).  I can do that right?  How, pretty please?
>
> Mark
>

The % operator doesn't work with lists, you need to make that a tuple.
It should work then.

Hugo


More information about the Tutor mailing list