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,
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
"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
"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
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
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
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 '
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