Hello, 
 
Solved it.
 
Problem was that I used fileinfo instead of getinfo.
 
Thanks for the help.
 
Roelof
 
 
 
 
 Date: Thu, 14 Oct 2010 18:55:50 -0400
> From: joel.goldst...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] join question
>
>
>
> On Thu, Oct 14, 2010 at 6:43 PM, Alan Gauld
> > wrote:
>
> "Roelof Wobben" > wrote
>
>
>
> print ''.join([zf.getinfo('%s.txt' % p).comment for p in zpp])
>
> So I thought that this would be the same :
>
> for p in zpp:
> test = zf.getinfo(p).comment
> print ''.join(test)
>
> But it seems not to work
>
> Can anyone explain why not ?
>
> Because it's not the same. test in your version is only a single item.
> In the original its a list of items. So to write similar code
> explicitly you need:
>
> lst = []
>
> for p in zpp:
> test = zf.getinfo(p).comment
> lst.append(test)
> print ''.join(lst)
>
> HTH,
>
> Alan G.
>
>
> There are two problems. Alan shows the solution to the joining of each
> element of the list, but also you need to have the correct argument for
> getinfo. In your first example you append ".txt" to p, but in the loop
> example you fail to append it. See my earlier post
>
> --
> Joel Goldstick
>
>
> _______________________________________________ Tutor maillist -
> Tutor@python.org To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor                                 
>           
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to