<?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>Blog do Zé Andrade &#187; python</title>
	<atom:link href="http://www.zeandrade.com.br/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zeandrade.com.br</link>
	<description>T.I. , Software Livre &#38; Generalidades</description>
	<lastBuildDate>Sat, 25 Feb 2012 19:20:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Console interativo no Python &#8211; melhorado!</title>
		<link>http://www.zeandrade.com.br/2010/11/console-interativo-no-python-melhorado/</link>
		<comments>http://www.zeandrade.com.br/2010/11/console-interativo-no-python-melhorado/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 20:15:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programação]]></category>
		<category><![CDATA[T.I.]]></category>
		<category><![CDATA[ipython]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://an.drade.nom.br/?p=195</guid>
		<description><![CDATA[Eu que já curto o Python e estava acostumado a testar recursos no console interativo, ao digitar o comando &#8220;python&#8221;, agora aproveito ainda melhor os recursos de documentação embutida das classes em python. Basta utilizar o aplicativo &#8216;ipython&#8217;. O &#8216;ipython&#8217; oferece um console muito mais poderoso. Teste já (se for necessário, instale o ipython):  [Atenção [...]]]></description>
			<content:encoded><![CDATA[<p>Eu que já curto o Python e estava acostumado a testar recursos no console interativo, ao digitar o comando &#8220;python&#8221;, agora aproveito ainda melhor os recursos de documentação embutida das classes em python. Basta utilizar o aplicativo &#8216;ipython&#8217;.</p>
<p>O &#8216;ipython&#8217; oferece um console muito mais poderoso.</p>
<p>Teste já (se for necessário, instale o <a href="http://ipython.scipy.org/moin/Documentation" target="_blank">ipython</a>):  [Atenção à pontuação pertinente!]</p>
<p><strong>1.</strong> digite  <strong>ipython</strong></p>
<p><strong>2. </strong>digite<strong> import os</strong></p>
<p><strong>3. </strong>digite<strong> os. </strong>e pressione a tecla<strong> [TAB]</strong></p>
<p><strong>4</strong>.digite <strong>os.kill ?</strong></p>
<p><strong>5</strong><strong>. </strong>digite<strong> a = 2</strong></p>
<p><strong>6. </strong>digite<strong> a ?<br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zeandrade.com.br/2010/11/console-interativo-no-python-melhorado/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python &#8211; emulando comandos shell</title>
		<link>http://www.zeandrade.com.br/2010/01/python-emulando-comandos-shell/</link>
		<comments>http://www.zeandrade.com.br/2010/01/python-emulando-comandos-shell/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 17:01:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programação]]></category>
		<category><![CDATA[T.I.]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://an.drade.nom.br/?p=130</guid>
		<description><![CDATA[#!/usr/bin/python #-*- coding: UTF-8 -*- import os class Cmd(object): def __init__(self, cmd): self.cmd = cmd def __call__(self, *args): return os.system("%s %s" % (self.cmd, " ".join(args))) class Sh(object): def __getattr__(self, attribute): return Cmd(attribute) # exemplos de uso: sh = Sh() sh.ls('-la') sh.free() sh.ps('aux') sh.uname('-a')]]></description>
			<content:encoded><![CDATA[<pre><span style="font-style: italic; color: #808080;">#!/usr/bin/python</span>
<span style="font-style: italic; color: #808080;">#-*- coding: UTF-8 -*-</span>

<span style="color: #8940a4;">import</span><span style="color: #000000;"> os</span>

<span style="font-weight: bold; color: #ab2f24;">class</span><span style="color: #000000;"> Cmd</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">object</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">   </span><span style="font-weight: bold; color: #ab2f24;">def</span><span style="color: #000000;"> __init__</span><span style="color: #ff00ff;">(</span><span style="color: #008000;">self</span><span style="color: #000000;">, cmd</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">       </span><span style="color: #008000;">self</span><span style="color: #000000;">.cmd </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> cmd</span>
<span style="color: #000000;">   </span><span style="font-weight: bold; color: #ab2f24;">def</span><span style="color: #000000;"> __call__</span><span style="color: #ff00ff;">(</span><span style="color: #008000;">self</span><span style="color: #000000;">, </span><span style="color: #ff00ff;">*</span><span style="color: #000000;">args</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">       </span><span style="font-weight: bold; color: #ab2f24;">return</span><span style="color: #000000;"> os.system</span><span style="color: #ff00ff;">(</span><span style="color: #dd0000;">"</span><span style="color: #ff00ff;">%s</span><span style="color: #dd0000;"> </span><span style="color: #ff00ff;">%s</span><span style="color: #dd0000;">"</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">%</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">(</span><span style="color: #008000;">self</span><span style="color: #000000;">.cmd, </span><span style="color: #dd0000;">" "</span><span style="color: #000000;">.join</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">args</span><span style="color: #ff00ff;">)))</span>

<span style="font-weight: bold; color: #ab2f24;">class</span><span style="color: #000000;"> Sh</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">object</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">    </span><span style="font-weight: bold; color: #ab2f24;">def</span><span style="color: #000000;"> __getattr__</span><span style="color: #ff00ff;">(</span><span style="color: #008000;">self</span><span style="color: #000000;">, attribute</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">        </span><span style="font-weight: bold; color: #ab2f24;">return</span><span style="color: #000000;"> Cmd</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">attribute</span><span style="color: #ff00ff;">)</span>
<span style="font-style: italic; color: #808080;">
# exemplos de uso:</span>

<span style="color: #000000;">sh </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> Sh</span><span style="color: #ff00ff;">()</span>
<span style="color: #000000;">sh.ls</span><span style="color: #ff00ff;">(</span><span style="color: #dd0000;">'-la'</span><span style="color: #ff00ff;">)</span>
<span style="color: #000000;">sh.free</span><span style="color: #ff00ff;">()</span>
<span style="color: #000000;">sh.ps</span><span style="color: #ff00ff;">(</span><span style="color: #dd0000;">'aux'</span><span style="color: #ff00ff;">)</span>
<span style="color: #000000;">sh.uname</span><span style="color: #ff00ff;">(</span><span style="color: #dd0000;">'-a'</span><span style="color: #ff00ff;">)</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.zeandrade.com.br/2010/01/python-emulando-comandos-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python &#8211; ordenar linhas de um arquivo</title>
		<link>http://www.zeandrade.com.br/2010/01/python-ordenar-linhas-de-um-arquivo/</link>
		<comments>http://www.zeandrade.com.br/2010/01/python-ordenar-linhas-de-um-arquivo/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 16:51:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programação]]></category>
		<category><![CDATA[T.I.]]></category>
		<category><![CDATA[manipular arquivos]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://an.drade.nom.br/?p=126</guid>
		<description><![CDATA[uma dica legal que en contrei em : http://code.activestate.com/recipes/440612/ Um script em Pyhon para ordenar as linhas de um arquivo: #!/usr/bin/python # -*- coding: utf-8 -*- import sys map(sys.stdout.write, sorted(file(sys.argv[1]).readlines()))]]></description>
			<content:encoded><![CDATA[<p>uma dica legal que en contrei em :</p>
<p><a href="http://code.activestate.com/recipes/440612/" target="_blank">http://code.activestate.com/recipes/440612/</a></p>
<p>Um script em Pyhon para ordenar as linhas de um arquivo:</p>
<pre style="padding-left: 30px;"><span style="font-style: italic; color: #808080;">#!/usr/bin/python</span>
<span style="font-style: italic; color: #808080;"># -*- coding: utf-8 -*-</span>
<span style="color: #8940a4;">import</span><span style="color: #000000;"> sys</span>
<span style="color: #800000;">map</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">sys.stdout.write, sorted</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">file</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">sys.argv</span><span style="color: #ff00ff;">[</span><span style="color: #0000ff;">1</span><span style="color: #ff00ff;">])</span><span style="color: #000000;">.readlines</span><span style="color: #ff00ff;">()))</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.zeandrade.com.br/2010/01/python-ordenar-linhas-de-um-arquivo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

