<?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; python</title>
	<atom:link href="http://web.pyncus.com/tag/python/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>
		<item>
		<title>Find word in a string (Python)</title>
		<link>http://web.pyncus.com/2009/12/22/find-word-in-a-string-python/</link>
		<comments>http://web.pyncus.com/2009/12/22/find-word-in-a-string-python/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 19:36:21 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[find]]></category>

		<guid isPermaLink="false">http://web.pyncus.com/?p=568</guid>
		<description><![CDATA[When you want to find a word in a string, use find() e.g. import sys arg1 = sys.argv[1] # passing the first argument if arg1.find("off") == -1: # if arg1 does not contain "off" # do something else: # do something]]></description>
			<content:encoded><![CDATA[<p>When you want to find a word in a string, use find()</p>
<p>e.g.</p>
<pre>
<p>import sys<br />
arg1 = sys.argv[1] # passing the first argument</p>
<p>if arg1.find("off") == -1: # if arg1 does not contain "off"<br />
  # do something<br />
else:<br />
  # do something</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/12/22/find-word-in-a-string-python/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Python: How to read lines</title>
		<link>http://web.pyncus.com/2009/12/22/python-how-to-read-lines/</link>
		<comments>http://web.pyncus.com/2009/12/22/python-how-to-read-lines/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 19:32:44 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[readlines]]></category>

		<guid isPermaLink="false">http://web.pyncus.com/?p=565</guid>
		<description><![CDATA[Use readlines() For example, arg = "filename" f = open(arg, 'r') lines = f.readlines() f.close()]]></description>
			<content:encoded><![CDATA[<p>Use readlines()</p>
<p>For example,</p>
<pre>
arg = "filename"

f = open(arg, 'r')

lines = f.readlines()
f.close()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/12/22/python-how-to-read-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to change directory in python</title>
		<link>http://web.pyncus.com/2009/11/29/how-to-change-directory-in-python/</link>
		<comments>http://web.pyncus.com/2009/11/29/how-to-change-directory-in-python/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 02:59:50 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[chdir]]></category>
		<category><![CDATA[os]]></category>

		<guid isPermaLink="false">http://web.pyncus.com/?p=536</guid>
		<description><![CDATA[&#62;&#62;&#62;import os &#62;&#62;&#62;os.chdir(&#8216;..&#8217;) &#62;&#62;&#62;os.chdir(&#8216;/home/weboom/&#8217;)]]></description>
			<content:encoded><![CDATA[<p>&gt;&gt;&gt;import os</p>
<p>&gt;&gt;&gt;os.chdir(&#8216;..&#8217;)</p>
<p>&gt;&gt;&gt;os.chdir(&#8216;/home/weboom/&#8217;)</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/11/29/how-to-change-directory-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do you want to use datetime.datetime.now ?</title>
		<link>http://web.pyncus.com/2009/08/04/do-you-want-to-use-datetime-datetime-now/</link>
		<comments>http://web.pyncus.com/2009/08/04/do-you-want-to-use-datetime-datetime-now/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 07:49:13 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[datetime]]></category>

		<guid isPermaLink="false">http://weboom.wordpress.com/?p=403</guid>
		<description><![CDATA[Then, import datetime]]></description>
			<content:encoded><![CDATA[<p>Then,</p>
<p>import datetime</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/08/04/do-you-want-to-use-datetime-datetime-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Python dictionary?</title>
		<link>http://web.pyncus.com/2009/08/02/what-is-python-dictionary/</link>
		<comments>http://web.pyncus.com/2009/08/02/what-is-python-dictionary/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 19:18:28 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[value]]></category>

		<guid isPermaLink="false">http://weboom.wordpress.com/?p=393</guid>
		<description><![CDATA[If you don&#8217;t want to refer to the elements of a collection by their position number but prefer some other type of object as a key, use a python dictionary &#8212;&#8212;&#8212;&#8211; e.g., &#62;&#62;&#62; tel = {'jack': 4098, 'sape': 4139} &#62;&#62;&#62; tel['guido'] = 4127 &#62;&#62;&#62; tel {'sape': 4139, 'guido': 4127, 'jack': 4098} &#62;&#62;&#62; tel['jack'] 4098 &#62;&#62;&#62; <a href='http://web.pyncus.com/2009/08/02/what-is-python-dictionary/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t want to refer to the elements of a collection by their position number but prefer some other type of object as a key,</p>
<p>use a python dictionary</p>
<p>&#8212;&#8212;&#8212;&#8211;</p>
<p>e.g.,</p>
<pre><span>&gt;&gt;&gt; </span><span>tel</span> <span>=</span> <span>{</span><span>'jack'</span><span>:</span> <span>4098</span><span>,</span> <span>'sape'</span><span>:</span> <span>4139</span><span>}</span>
<span>&gt;&gt;&gt; </span><span>tel</span><span>[</span><span>'guido'</span><span>]</span> <span>=</span> <span>4127</span>
<span>&gt;&gt;&gt; </span><span>tel</span>
<span>{'sape': 4139, 'guido': 4127, 'jack': 4098}</span>
<span>&gt;&gt;&gt; </span><span>tel</span><span>[</span><span>'jack'</span><span>]</span>
<span>4098</span>
<span>&gt;&gt;&gt; </span><span>del</span> <span>tel</span><span>[</span><span>'sape'</span><span>]</span>
<span>&gt;&gt;&gt; </span><span>tel</span><span>[</span><span>'irv'</span><span>]</span> <span>=</span> <span>4127</span>
<span>&gt;&gt;&gt; </span><span>tel</span>
<span>{'guido': 4127, 'irv': 4127, 'jack': 4098}</span>
<span>&gt;&gt;&gt; </span><span>tel</span><span>.</span><span>keys</span><span>()</span>
<span>['guido', 'irv', 'jack']</span>
<span>&gt;&gt;&gt; </span><span>'guido'</span> <span>in</span> <span>tel</span>
<span>True</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/08/02/what-is-python-dictionary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>list vs. tuple</title>
		<link>http://web.pyncus.com/2009/08/02/list-vs-tuple/</link>
		<comments>http://web.pyncus.com/2009/08/02/list-vs-tuple/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 19:12:40 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[immutable]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[tuple]]></category>

		<guid isPermaLink="false">http://weboom.wordpress.com/?p=391</guid>
		<description><![CDATA[Python list and tuple, both of them consists of multiple objects identified its position. list L=[1, 2, 3] tuple T=(1,2,3) Difference between them is that tuple is immutable. That is, L[0]=100 is OK, but T[0]=100 is not allowed.]]></description>
			<content:encoded><![CDATA[<p>Python list and tuple, both of them consists of multiple objects identified its position.</p>
<p>list</p>
<p>L=[1, 2, 3]</p>
<p>tuple</p>
<p>T=(1,2,3)</p>
<p>Difference between them is that tuple is immutable.</p>
<p>That is,</p>
<p>L[0]=100</p>
<p>is OK, but</p>
<p>T[0]=100</p>
<p>is not allowed.</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/08/02/list-vs-tuple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Python tuple?</title>
		<link>http://web.pyncus.com/2009/08/02/what-is-python-tuple/</link>
		<comments>http://web.pyncus.com/2009/08/02/what-is-python-tuple/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 19:09:51 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[tuple]]></category>

		<guid isPermaLink="false">http://weboom.wordpress.com/?p=389</guid>
		<description><![CDATA[Python tuple consist of a number of objects which can be referenced by their position number within the object. &#8212;&#8212;&#8212; e.g., fruit = (&#8220;Apple&#8221;,&#8221;Banana&#8221;,&#8221;Cherry&#8221;,&#8221;Fig&#8221;,&#8221;Grapefruit&#8221;)]]></description>
			<content:encoded><![CDATA[<p>Python tuple</p>
<p>consist of a number of objects which can be referenced by their position number within the object.</p>
<p>&#8212;&#8212;&#8212;</p>
<p>e.g.,</p>
<p>fruit = (&#8220;Apple&#8221;,&#8221;Banana&#8221;,&#8221;Cherry&#8221;,&#8221;Fig&#8221;,&#8221;Grapefruit&#8221;)</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/08/02/what-is-python-tuple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What for &quot;__unicode__&quot;?</title>
		<link>http://web.pyncus.com/2009/08/02/what-for-__unicode__/</link>
		<comments>http://web.pyncus.com/2009/08/02/what-for-__unicode__/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 05:22:02 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[__unicode__]]></category>

		<guid isPermaLink="false">http://weboom.wordpress.com/?p=351</guid>
		<description><![CDATA[__unicode__ is for displaying objects. &#8212;&#8212;&#8212;&#8211; For example, &#62;&#62;&#62;p = Card.objects.create(name=&#8217;Hot Pot&#8217;, city=&#8217;San Diego&#8217;) &#62;&#62;&#62;card_list = Card.objects.all() &#62;&#62;&#62;card_list [&#60;Card: Card object&#62;] without __unicode__, you will see just &#8220;Card object&#8221; if you define __unicode__ def __unicode__(self): return self.name then, you will see [&#60;Card: Hot Pot&#62;]]]></description>
			<content:encoded><![CDATA[<p>__unicode__</p>
<p>is for displaying objects.</p>
<p>&#8212;&#8212;&#8212;&#8211;</p>
<p>For example,</p>
<p>&gt;&gt;&gt;p = Card.objects.create(name=&#8217;Hot Pot&#8217;, city=&#8217;San Diego&#8217;)</p>
<p>&gt;&gt;&gt;card_list = Card.objects.all()</p>
<p>&gt;&gt;&gt;card_list</p>
<p>[&lt;Card: Card object&gt;]</p>
<p>without __unicode__, you will see just &#8220;Card object&#8221;</p>
<p>if you define __unicode__</p>
<p><code>def __unicode__(self):</code></p>
<p><code> return self.name</code></p>
<p>then, you will see</p>
<p>[&lt;Card: Hot Pot&gt;]</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/08/02/what-for-__unicode__/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Python list?</title>
		<link>http://web.pyncus.com/2009/08/02/what-is-python-list/</link>
		<comments>http://web.pyncus.com/2009/08/02/what-is-python-list/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 05:02:49 +0000</pubDate>
		<dc:creator>weboom</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[list]]></category>

		<guid isPermaLink="false">http://weboom.wordpress.com/?p=346</guid>
		<description><![CDATA[Python list is  a container that holds a number of other objects, in a given order. L=[1, 2, 3, 4]]]></description>
			<content:encoded><![CDATA[<p>Python list</p>
<p>is  a container that holds a number of other objects, in a given order.</p>
<p>L=[1, 2, 3, 4]</p>
]]></content:encoded>
			<wfw:commentRss>http://web.pyncus.com/2009/08/02/what-is-python-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

