<?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: Python: Simple File Read and Write</title>
	<atom:link href="http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/</link>
	<description>the Q stands for quality</description>
	<lastBuildDate>Fri, 25 Dec 2009 18:24:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: heather</title>
		<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/comment-page-1/#comment-10829</link>
		<dc:creator>heather</dc:creator>
		<pubDate>Wed, 01 Apr 2009 15:07:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.techniqal.com/blog/?p=8#comment-10829</guid>
		<description>I agree with your first statements, there is quite a bit of python help out there, but hard to get to the simple stuff.  Am tryng to open a txt file, pull certain parts out, and then write to a new csv....get bits of it, but not the whole process, any help would be great, thanks</description>
		<content:encoded><![CDATA[<p>I agree with your first statements, there is quite a bit of python help out there, but hard to get to the simple stuff.  Am tryng to open a txt file, pull certain parts out, and then write to a new csv&#8230;.get bits of it, but not the whole process, any help would be great, thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karuppiah</title>
		<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/comment-page-1/#comment-10791</link>
		<dc:creator>karuppiah</dc:creator>
		<pubDate>Thu, 12 Feb 2009 14:24:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.techniqal.com/blog/?p=8#comment-10791</guid>
		<description>Hi,&lt;br&gt;I am opening a file in r+ mode. I have a problem in this. If I first write in a file and then read the same file it is working fine. But some junk characters are added to the end of the string. &lt;br&gt;Also one more problem if I read it first say using readline function and then write it, the write operation doesn&#039;t happen. Any idea what might be the problem?</description>
		<content:encoded><![CDATA[<p>Hi,<br />I am opening a file in r+ mode. I have a problem in this. If I first write in a file and then read the same file it is working fine. But some junk characters are added to the end of the string. <br />Also one more problem if I read it first say using readline function and then write it, the write operation doesn&#39;t happen. Any idea what might be the problem?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaun</title>
		<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/comment-page-1/#comment-10761</link>
		<dc:creator>shaun</dc:creator>
		<pubDate>Fri, 19 Dec 2008 13:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.techniqal.com/blog/?p=8#comment-10761</guid>
		<description>hi, how would you read the whole file in but exclude say the first 4 bytes of it?  &lt;br&gt;thanks&lt;br&gt;sean</description>
		<content:encoded><![CDATA[<p>hi, how would you read the whole file in but exclude say the first 4 bytes of it?  <br />thanks<br />sean</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/comment-page-1/#comment-10759</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Thu, 18 Dec 2008 17:02:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.techniqal.com/blog/?p=8#comment-10759</guid>
		<description>Well, &lt;br&gt;I would argue that the input is a list already. If you are wanting to return a subset of the GeneCode list, I would do the following.  There are more graceful ways to achieve this, but this method shows you the logic involved.&lt;br&gt;&lt;br&gt;x = [0,1,2,3]&lt;br&gt;GeneCode = [&#039;AAAA&#039;,&#039;AAAC&#039;,&#039;AAAG&#039;,&#039;AAAT&#039;]&lt;br&gt;&lt;br&gt;def Li_to_GC(x):&lt;br&gt;	newList = [GeneCode[i] for i in x]&lt;br&gt;	return newList&lt;br&gt;&lt;br&gt;print Li_to_GC(x)&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;In this case, you can then pass any numeric list to LI_to_GC and get the corresponding Genecodes list back.&lt;br&gt;I would check out this great List comprehension article here, and you can learn more. &lt;a href=&quot;http://effbot.org/zone/python-list.htm&quot; rel=&quot;nofollow&quot;&gt;http://effbot.org/zone/python-list.htm&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Well, <br />I would argue that the input is a list already. If you are wanting to return a subset of the GeneCode list, I would do the following.  There are more graceful ways to achieve this, but this method shows you the logic involved.</p>
<p>x = [0,1,2,3]<br />GeneCode = [&#39;AAAA&#39;,&#39;AAAC&#39;,&#39;AAAG&#39;,&#39;AAAT&#39;]</p>
<p>def Li_to_GC(x):<br />	newList = [GeneCode[i] for i in x]<br />	return newList</p>
<p>print Li_to_GC(x)</p>
<p>In this case, you can then pass any numeric list to LI_to_GC and get the corresponding Genecodes list back.<br />I would check out this great List comprehension article here, and you can learn more. <a href="http://effbot.org/zone/python-list.htm" rel="nofollow">http://effbot.org/zone/python-list.htm</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reza</title>
		<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/comment-page-1/#comment-10757</link>
		<dc:creator>Reza</dc:creator>
		<pubDate>Wed, 17 Dec 2008 17:53:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.techniqal.com/blog/?p=8#comment-10757</guid>
		<description>Thank you Daniel, another problem: &lt;br&gt;x = [0,1,2,3]&lt;br&gt;GeneCode = [&#039;AAAA&#039;,&#039;AAAC&#039;,&#039;AAAG&#039;,&#039;AAAT&#039;]&lt;br&gt;def Li_to_GC(x):&lt;br&gt;    for i in x:&lt;br&gt;            print GeneCode[i],&lt;br&gt;Li_to_GC(x)&lt;br&gt;&lt;br&gt;How can convert the result to the list or string?</description>
		<content:encoded><![CDATA[<p>Thank you Daniel, another problem: <br />x = [0,1,2,3]<br />GeneCode = [&#39;AAAA&#39;,&#39;AAAC&#39;,&#39;AAAG&#39;,&#39;AAAT&#39;]<br />def Li_to_GC(x):<br />    for i in x:<br />            print GeneCode[i],<br />Li_to_GC(x)</p>
<p>How can convert the result to the list or string?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/comment-page-1/#comment-10747</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 28 Nov 2008 17:55:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.techniqal.com/blog/?p=8#comment-10747</guid>
		<description>All you need to do is specify the location of the file you want to save to.&lt;br&gt;&lt;br&gt;So when opening the second file, specify the directory then. &lt;br&gt;Example on win32:&lt;br&gt;file = open(&quot;my_dir\newfile.txt&quot;,&quot;w&quot;) &lt;br&gt;Example on *nix :&lt;br&gt;file = open(&quot;my_dir/newfile.txt&quot;,&quot;w&quot;)&lt;br&gt;&lt;br&gt;This will create the new file in the directory &quot;my_dir&quot; assuming the directory exists in the same folder as your python script. You can also specify an absolute file path as well.</description>
		<content:encoded><![CDATA[<p>All you need to do is specify the location of the file you want to save to.</p>
<p>So when opening the second file, specify the directory then. <br />Example on win32:<br />file = open(&#8220;my_dir\newfile.txt&#8221;,&#8221;w&#8221;) <br />Example on *nix :<br />file = open(&#8220;my_dir/newfile.txt&#8221;,&#8221;w&#8221;)</p>
<p>This will create the new file in the directory &#8220;my_dir&#8221; assuming the directory exists in the same folder as your python script. You can also specify an absolute file path as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reza</title>
		<link>http://www.techniqal.com/blog/2005/05/17/python-simple-file-read-and-write/comment-page-1/#comment-10745</link>
		<dc:creator>Reza</dc:creator>
		<pubDate>Fri, 28 Nov 2008 17:04:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.techniqal.com/blog/?p=8#comment-10745</guid>
		<description>Hi, I have opened my file I have manipulated and I want save this new change in the other directory. At least I know that I should be use &#039; r &#039; for reading and &#039; w &#039; command for writing, but I do not know how I can make connection between readings and manipulate file and writing this manipulation in the other file.&lt;br&gt;Best Regards&lt;br&gt;Reza _ Finland</description>
		<content:encoded><![CDATA[<p>Hi, I have opened my file I have manipulated and I want save this new change in the other directory. At least I know that I should be use &#39; r &#39; for reading and &#39; w &#39; command for writing, but I do not know how I can make connection between readings and manipulate file and writing this manipulation in the other file.<br />Best Regards<br />Reza _ Finland</p>
]]></content:encoded>
	</item>
</channel>
</rss>