Re: [Tutor] join question

2010-10-15 Thread Roelof Wobben
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,

Re: [Tutor] join question

2010-10-14 Thread Joel Goldstick
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 see

Re: [Tutor] join question

2010-10-14 Thread Alan Gauld
"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

Re: [Tutor] join question

2010-10-14 Thread davidheiserca
"join" operates on lists. It "joins" the elements of the list using the leading character or string as the delimiter. In this case it is NUL. Try putting a character or string, like 'XX\n' in front of the ".join" in both places. It should illustrate what's really happening. "XX\n".jo

Re: [Tutor] join question

2010-10-14 Thread bob gailer
Hello, I found this answer to a problem for me : 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 ? P

Re: [Tutor] join question

2010-10-14 Thread Emile van Sebille
On 10/14/2010 6:50 AM Roelof Wobben said... Hello, I found this answer to a problem for me : 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 This isn't transcribed properly

Re: [Tutor] join question

2010-10-14 Thread Joel Goldstick
On Thu, Oct 14, 2010 at 9:50 AM, Roelof Wobben wrote: > > > Hello, > > I found this answer to a problem for me : > > > 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 '

Re: [Tutor] join question

2010-10-14 Thread Hugo Arts
On Thu, Oct 14, 2010 at 3:50 PM, Roelof Wobben 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