<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Oom &#187; writelines</title>
	<atom:link href="http://web.pyncus.com/tag/writelines/feed/" rel="self" type="application/rss+xml" />
	<link>http://web.pyncus.com</link>
	<description>Build and Share Web Technology</description>
	<lastBuildDate>Mon, 25 Jan 2010 18:19:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>How to write lines (Python)</title>
		<link>http://web.pyncus.com/2009/12/22/how-to-write-lines-python/</link>
		<comments>http://web.pyncus.com/2009/12/22/how-to-write-lines-python/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 19:53:16 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[writelines]]></category>

		<guid isPermaLink="false">http://web.pyncus.com/?p=570</guid>
		<description><![CDATA[Use writelines() e.g. # read lines in a file import sys arg1 = sys.argv[1] f = open(arg1, 'r') lines = f.readlines() f.close() arg='out_'+arg1 FILE=open(arg,'w') for line in lines: words = line.split(' ') if words[1] == 'hypnos': FILE.writelines(line) FILE.close()]]></description>
			<content:encoded><![CDATA[<p>Use writelines()</p>
<p>e.g.</p>
<pre>
<p># read lines in a file<br />
import sys<br />
arg1 = sys.argv[1]</p>
<p>f = open(arg1, 'r')</p>
<p>lines = f.readlines()<br />
f.close()</p>
<p>arg='out_'+arg1<br />
FILE=open(arg,'w')</p>
<p>for line in lines:<br />
     words = line.split(' ')<br />
     if words[1] == 'hypnos':<br />
          FILE.writelines(line)<br />
FILE.close()</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/12/22/how-to-write-lines-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

