Ethan Furman wrote:
[email protected] 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~
Hello,

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..
http://www.rayslinks.com/LinuxdpkgSoftwareReport.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com


_______________________________________________
Portland mailing list
[email protected]
http://mail.python.org/mailman/listinfo/portland

Reply via email to