On Thu, Oct 14, 2010 at 3:50 PM, Roelof Wobben <rwob...@hotmail.com> wrote:
>
>
> Hello,
>
> I found this answer to a problem for me :
>
>
> print ''.join([zf.getinfo('%s.txt' % p).comment for p in zpp])
>

Look at the argument given to join here. It is a list comprehension.
The result of a list comprehension is a list. You're calling join
once, with a list as argument.

> So I thought that this would be the same :
>
> for p in zpp:
>      test = zf.getinfo(p).comment
>      print ''.join(test)
>

Now look at the argument to join again. It is not a list, but a single
element of a list. Also, you're calling join for every element,
instead of just once. That's not the same thing, is it?

> But it seems not to work
>
> Can anyone explain why not ?
>
> Roelof
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to