[portland] Array writing question from landscape ecologist

Ray Parrish crp at cmc.net
Sat Mar 13 02:24:12 CET 2010

Ethan Furman wrote:
> lintzh at science.oregonstate.edu wrote:
> [snippety]
>>     with open(outfilename,'w') as outfile:
>>         outfile.write(header)
>>         for line in data4:
>>             line.replace('[',' ').replace(']',' ')
>>             outfile.write(line)
>           for line in data4:
>               outfile.write(','.join([str(item) for item in line]))
> ~Ethan~

Sorry to jump in here, but I am fairly new to Python programming, and 
the syntax you are using in your answer is intriguing me. I missed the 
question, as I just joined this group last night.

Could you please explain to me what the ','.join() is doing in your 
write command?

I understand the code for the loop above, but it is new to me, so if 
there is a mistake in it, that the question was about, I would 
appreciate being informed of what I missed to facilitate my ultimate 
understanding of the with construct, which I am pretty shaky on so far.

Thanks, Ray Parrish

Linux dpkg Software Report script set..
Ray's Links, a variety of links to usefull things, and articles by Ray.
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.

More information about the Portland mailing list