<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Writing to files</title>
	<atom:link href="http://python.genedrift.org/2007/03/13/writing-to-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://python.genedrift.org/2007/03/13/writing-to-files/</link>
	<description>a step-by-step guide to create Python applications in bioinformatics</description>
	<lastBuildDate>Sun, 02 May 2010 04:24:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
	<item>
		<title>By: nuin</title>
		<link>http://python.genedrift.org/2007/03/13/writing-to-files/comment-page-1/#comment-4485</link>
		<dc:creator>nuin</dc:creator>
		<pubDate>Tue, 23 Oct 2007 18:15:19 +0000</pubDate>
		<guid isPermaLink="false">http://python.genedrift.org/2007/03/13/writing-to-files/#comment-4485</guid>
		<description>Hi Dilmurat,

Indeed, it is a good practice to close files after finishing IO operations with them. It is not fully necessary as Python automatically closes opened files when the script ends. The examples here are not fancy that would make you lose data if you don&#039;t close the files, but this can happen in more complex applications. 

From Alan Gauld&#039;s Python tutorial:

Note 4: We close the file at the end with the close() method. In Python, files are automatically closed at the end of the program but it is good practice to get into the habit of closing your files explicitly. Why? Well, the operating system may not write the data out to the file until it is closed (this can boost performance). What this means is that if the program exits unexpectedly there is a danger that your precious data may not have been written to the file! So the moral is: once you finish writing to a file, close it.

More here http://www.freenetpages.co.uk/hp/alan.gauld/tutfiles.htm

Cheers

Paulo</description>
		<content:encoded><![CDATA[<p>Hi Dilmurat,</p>
<p>Indeed, it is a good practice to close files after finishing IO operations with them. It is not fully necessary as Python automatically closes opened files when the script ends. The examples here are not fancy that would make you lose data if you don&#8217;t close the files, but this can happen in more complex applications. </p>
<p>From Alan Gauld&#8217;s Python tutorial:</p>
<p>Note 4: We close the file at the end with the close() method. In Python, files are automatically closed at the end of the program but it is good practice to get into the habit of closing your files explicitly. Why? Well, the operating system may not write the data out to the file until it is closed (this can boost performance). What this means is that if the program exits unexpectedly there is a danger that your precious data may not have been written to the file! So the moral is: once you finish writing to a file, close it.</p>
<p>More here <a href="http://www.freenetpages.co.uk/hp/alan.gauld/tutfiles.htm" rel="nofollow">http://www.freenetpages.co.uk/hp/alan.gauld/tutfiles.htm</a></p>
<p>Cheers</p>
<p>Paulo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dilmurat</title>
		<link>http://python.genedrift.org/2007/03/13/writing-to-files/comment-page-1/#comment-4484</link>
		<dc:creator>Dilmurat</dc:creator>
		<pubDate>Tue, 23 Oct 2007 18:09:25 +0000</pubDate>
		<guid isPermaLink="false">http://python.genedrift.org/2007/03/13/writing-to-files/#comment-4484</guid>
		<description>Hi Paulo:

After finishing a task with a file for reading or writing, is it better to close it, like &#039; resultfile.close()&#039;?

Thanks,
Dilmurat</description>
		<content:encoded><![CDATA[<p>Hi Paulo:</p>
<p>After finishing a task with a file for reading or writing, is it better to close it, like &#8216; resultfile.close()&#8217;?</p>
<p>Thanks,<br />
Dilmurat</p>
]]></content:encoded>
	</item>
</channel>
</rss>

