<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2240031811551496628</id><updated>2012-04-10T22:32:50.564-03:00</updated><category term='exemplo'/><category term='desafios'/><category term='curso'/><category term='opinião'/><category term='iniciante'/><category term='django'/><category term='curiosidades'/><category term='links'/><category term='pegadinha'/><title type='text'>Aprenda Python</title><subtitle type='html'>Dicas para você que já é programador em outra linguagem.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default?start-index=26&amp;max-results=25'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>55</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-8190049010303257813</id><published>2011-11-21T01:44:00.002-02:00</published><updated>2011-11-21T01:54:53.033-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><title type='text'>Várias versões de Python ao mesmo tempo</title><summary type='text'>Estou precisando ter o Python 2.6 (padrão no Ubuntu 10.04) convivendo harmoniosamente com a versão 2.7. Ou seja, mais de uma versão no mesmo sistema operacional.

Pesquisando, encontrei um repositório para Ubuntu com várias versões de Python: https://launchpad.net/~fkrull/+archive/deadsnakes

Achei também uma forma de fazer com que elas não briguem e não atrapalhem o que já funciona, dentro do </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/8190049010303257813/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2011/11/varias-versoes-de-python-ao-mesmo-tempo.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/8190049010303257813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/8190049010303257813'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2011/11/varias-versoes-de-python-ao-mesmo-tempo.html' title='Várias versões de Python ao mesmo tempo'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-6477139283838211798</id><published>2011-10-24T15:14:00.000-02:00</published><updated>2011-10-24T15:14:18.015-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Programe conforme o PEP8</title><summary type='text'>Quando escrevemos programas na linguagem Python, é bom seguirmos as recomendações do  PEP8, que é uma convenção com padrões de codificação e recomenda, dentre outras coisas, que não misturamos tabs e espaços.

Como o PEP8 é formado de várias recomendações, às vezes é trabalhoso ficar conferindo se você está dentro do padrão ou não. Quando se aprende, tudo vai automático, mas quando você vem de </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/6477139283838211798/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2011/10/programe-conforme-o-pep8.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/6477139283838211798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/6477139283838211798'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2011/10/programe-conforme-o-pep8.html' title='Programe conforme o PEP8'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-4239310891363073089</id><published>2011-09-26T19:14:00.002-03:00</published><updated>2011-09-27T11:36:57.542-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Inverter strings</title><summary type='text'>Dada uma string, quero mostrá-la invertida. Em python é muito simples.
&gt;&gt;&gt; 'eu gosto de python'[::-1]
'nohtyp ed otsog ue'
E se eu quiser inverter palavra por palavra, mas mantendo a ordem em que as palavras aparecem no texto?
&gt;&gt;&gt; ' '.join([word[::-1] for word in 'eu gosto de python'.split()])
'ue otsog ed nohtyp'
A dica aqui é usar o slicing de um jeito não muito comum: com o argumento step (o </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/4239310891363073089/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2011/09/inverter-strings.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4239310891363073089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4239310891363073089'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2011/09/inverter-strings.html' title='Inverter strings'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-2443954561225023667</id><published>2011-09-13T21:11:00.000-03:00</published><updated>2011-09-13T21:11:28.581-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><title type='text'>Itens comuns a mais de uma lista</title><summary type='text'>Em Python é muito prático trabalhar com listas.
Uma situação bastante comum é ter duas ou três listas e querer descobrir quais itens fazem parte de todas elas ou de mais de uma lista.

Para facilitar essa operação, temos o tipo de dado set.

Veja o exemplo:

&gt;&gt;&gt; aqui = set([1, 2, 3])
&gt;&gt;&gt; agora = set([2, 4, 5])
&gt;&gt;&gt; depois = set([2, 10, 15])
&gt;&gt;&gt; aqui.intersection(agora, depois)
set([2])
Dessa forma</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/2443954561225023667/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2011/09/itens-comuns-mais-de-uma-lista.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/2443954561225023667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/2443954561225023667'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2011/09/itens-comuns-mais-de-uma-lista.html' title='Itens comuns a mais de uma lista'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-9096251856521862133</id><published>2011-09-12T23:07:00.001-03:00</published><updated>2011-09-12T23:09:48.512-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Ordenando uma lista por mais de um campo</title><summary type='text'>A ordenação de listas em Python tem muito poder quando você tem uma lista de tuplas.

Para ordenar uma lista de tuplas, a função sorted() classifica o primeiro item da tupla, depois o segundo, e assim por diante.

Vamos a um exemplo: tenho uma lista de pessoas com nome, idade e salário. Quero classificá-la por idade (primeiro os mais jovens), salário (primeiro os que ganham mais) e por último, os</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/9096251856521862133/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2011/09/ordenando-uma-lista-por-mais-de-um.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/9096251856521862133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/9096251856521862133'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2011/09/ordenando-uma-lista-por-mais-de-um.html' title='Ordenando uma lista por mais de um campo'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-4730719217747668877</id><published>2011-02-24T01:13:00.003-03:00</published><updated>2011-02-24T01:14:14.755-03:00</updated><title type='text'>Shell online</title><summary type='text'>Nem preciso dizer muito.

Testa aí: http://shell.appspot.com</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/4730719217747668877/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2011/02/shell-online.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4730719217747668877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4730719217747668877'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2011/02/shell-online.html' title='Shell online'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-5845503317031534525</id><published>2010-11-11T02:46:00.001-02:00</published><updated>2010-11-11T02:49:11.997-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Ordenando e embaralhando uma lista</title><summary type='text'>Normalmente precisamos ordenar uma lista
Para isso, o método sort() é muito simples e direto:
&gt;&gt;&gt; lista = ['bbb', 'yyy', 'mmm', 'aaa', 'www', 'ddd']
&gt;&gt;&gt; lista.sort()
&gt;&gt;&gt; print lista
['aaa', 'bbb', 'ddd', 'mmm', 'www', 'yyy']
&gt;&gt;&gt;
Agora imagine que você queira ordenar sua lista pelo tamanho (len()) dos itens:
&gt;&gt;&gt; lista = ['aaaa', 'z', 'bbbbbbbbbb', 'nnn']
&gt;&gt;&gt; def por_tamanho(item):
...   return len</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/5845503317031534525/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/11/ordenando-e-embaralhando-uma-lista.html#comment-form' title='4 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/5845503317031534525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/5845503317031534525'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/11/ordenando-e-embaralhando-uma-lista.html' title='Ordenando e embaralhando uma lista'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-7048986033384491502</id><published>2010-11-04T14:09:00.005-02:00</published><updated>2010-11-08T09:55:54.113-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Operador ternário</title><summary type='text'>Para quem não sabe, o operador ternário é assim (em PHP): echo ($a &lt; $b ? 'a é menor' : 'a não é menor');

Em Python, você pode fazer assim: print 'a é menor' if a &lt; b else 'a não é menor'

Porém, eu recomendo que você faça o arroz-com-feijão, que fica muito mais simples de entender:
&gt;&gt;&gt; if a &lt; b:
...     print 'a é menor'
... else:
...     print 'a não é menor'

Lembre-se que simples é melhor do</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/7048986033384491502/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/11/operador-ternario.html#comment-form' title='5 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/7048986033384491502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/7048986033384491502'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/11/operador-ternario.html' title='Operador ternário'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-1660054640698533238</id><published>2010-10-22T14:43:00.001-02:00</published><updated>2010-10-22T14:44:20.580-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Exemplos de biblioteca padrão de Python</title><summary type='text'>Hoje eu descobri o Python Module of the Week.

É muito legal porque ele tem a biblioteca padrão documentada com muitos exemplos.

Esse projeto segue o princípio de que programador gosta de ver código. Se gostasse de explicação, seria comentarista de futebol.

Bem-vindo aos códigos.</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/1660054640698533238/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/exemplos-de-biblioteca-padrao-de-python.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1660054640698533238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1660054640698533238'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/exemplos-de-biblioteca-padrao-de-python.html' title='Exemplos de biblioteca padrão de Python'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-3993760358552085394</id><published>2010-10-22T14:22:00.000-02:00</published><updated>2010-10-22T14:22:03.758-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Como lidar com datas em Python</title><summary type='text'>Eu encontrei um  ótimo artigo que traz explicações e exemplos de como mexer com datas em Python: datetime – Date/time value manipulation

Lá eu esclareci algumas  dúvidas comuns sobre como adicionar, subtrair ou formatar datas. Bem didático, com muitos exemplos.

Especificamente para formatar datas, eu sempre recorro à tabela com todos os códigos para formatação de data e hora no Python. Entra no</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/3993760358552085394/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/como-lidar-com-datas-em-python.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3993760358552085394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3993760358552085394'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/como-lidar-com-datas-em-python.html' title='Como lidar com datas em Python'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-1111777915495225475</id><published>2010-10-19T23:58:00.002-02:00</published><updated>2010-10-20T00:13:31.878-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><title type='text'>Função que retorna vários valores</title><summary type='text'>Em Python é possível ver uma função (ou método) retornar mais de um valor tirando proveito de listas e tuplas:

&gt;&gt;&gt; def dados_pessoais():
...   return ('joao', 16)
...
&gt;&gt;&gt; nome, idade = dados_pessoais()
&gt;&gt;&gt;
&gt;&gt;&gt; nome
'joao'
&gt;&gt;&gt; idade
16
&gt;&gt;&gt;
Sem complicação, né?

Aproveite e veja como desempacotar uma lista ou tupla atribuindo valor a várias variáveis ao mesmo tempo:

&gt;&gt;&gt; registro = ('marcos', '</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/1111777915495225475/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/funcao-que-retorna-varios-valores.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1111777915495225475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1111777915495225475'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/funcao-que-retorna-varios-valores.html' title='Função que retorna vários valores'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-5825221233710675796</id><published>2010-10-18T11:25:00.001-02:00</published><updated>2010-10-18T11:27:02.998-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Ver o tipo de uma variável</title><summary type='text'>Outro dia lembrei que há um tempo quebrei um pouco a cabeça para descobrir como saber o tipo de uma variável em Python.

É fácil, ó:
&gt;&gt;&gt; s = 'texto'
&gt;&gt;&gt; if type(s) is str:
...   print 'sou string'

Para checar outros tipos, use tuple, list, dict, int, float, unicode.

Fica aí a dica e sugiro que você faça testes no shell.</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/5825221233710675796/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/ver-o-tipo-de-uma-variavel.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/5825221233710675796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/5825221233710675796'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/10/ver-o-tipo-de-uma-variavel.html' title='Ver o tipo de uma variável'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-1152461066590453668</id><published>2010-09-22T21:35:00.000-03:00</published><updated>2010-09-22T21:35:00.487-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Veja seu programa python rodando!</title><summary type='text'>O Online Python Tutor é muito bom para quem está aprendendo a programar e praticar os conceitos de lógica.

Com ele você consegue acompanhar a execução do seu código linha a linha, como se fosse um depurador. E ele ainda mostra as variáveis e seus conteúdos.

Não é recomendado para depurar código, não. É só para aprender mesmo.</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/1152461066590453668/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/veja-seu-programa-python-rodando.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1152461066590453668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1152461066590453668'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/veja-seu-programa-python-rodando.html' title='Veja seu programa python rodando!'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-6448368774823315341</id><published>2010-09-17T16:16:00.000-03:00</published><updated>2010-09-17T16:16:48.833-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='desafios'/><category scheme='http://www.blogger.com/atom/ns#' term='curso'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Pratique Python online no CodingBat</title><summary type='text'>Há alguns dias eu postei sobre um curso de Python elaborado pelo Google.

Fuçando, descobri que o autor, Nick Parlante, é professor de Stanford e mantém um projeto bem legal para ajudar pessoas a aprenderem Python e Java. É o CodingBat.

É um bom lugar para praticar Python e ver os resultados ali, na hora.</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/6448368774823315341/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/pratique-python-online-no-codingbat.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/6448368774823315341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/6448368774823315341'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/pratique-python-online-no-codingbat.html' title='Pratique Python online no CodingBat'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-745754397521040929</id><published>2010-09-16T23:17:00.001-03:00</published><updated>2010-09-16T23:23:14.387-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Garanta o fechamento dos arquivos</title><summary type='text'>Há alguns dias rolou uma thread interessante na lista Python Brasil sobre leitura de arquivos texto.

O Leonardo Santagada fez uma observação importantíssima a respeito de como devemos abrir e ler arquivos em Python.


A recomendação dele é abrir e ler arquivos usando o seguinte pattern:
with open('arquivo.txt') as arquivo:
    for linha in arquivo:
        print linha.strip()

Em seguida, o </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/745754397521040929/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/garanta-o-fechamento-dos-arquivos.html#comment-form' title='4 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/745754397521040929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/745754397521040929'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/garanta-o-fechamento-dos-arquivos.html' title='Garanta o fechamento dos arquivos'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-1082570995396359951</id><published>2010-09-08T15:55:00.003-03:00</published><updated>2010-09-09T10:23:33.047-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curso'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Curso gratuito de Python em portugues no Youtube</title><summary type='text'>O curso "Lógica de Programação Usando Python - Curso Completo" é uma iniciativa do prof. Ronaldo Ramos, do Instituto Federal de Educação Ciência e Tecnologia do Ceará.

No site do IFET-CE tem o índice com todas as aulas em vídeo, e também tem a página do autor, no Youtube.

Na data desse post (08/set/2010) constavam 21 aulas disponíveis. 

Vale visitar o site deles, o Lambda, que fala sobre </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/1082570995396359951/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/curso-gratuito-de-python-em-portugues.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1082570995396359951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1082570995396359951'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/curso-gratuito-de-python-em-portugues.html' title='Curso gratuito de Python em portugues no Youtube'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-1836106849051714890</id><published>2010-09-08T14:55:00.000-03:00</published><updated>2010-09-08T14:55:23.958-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curso'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Curso de Python no Under Linux</title><summary type='text'>Segue o link de mais um curso gratuito de python criado em agosto/2010.

Esse é em português: Curso de Introdução ao Python</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/1836106849051714890/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/curso-de-python-no-under-linux.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1836106849051714890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1836106849051714890'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/curso-de-python-no-under-linux.html' title='Curso de Python no Under Linux'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-4412278979658635910</id><published>2010-09-02T23:29:00.002-03:00</published><updated>2010-09-08T14:52:00.700-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curso'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Aprenda Python com o MIT</title><summary type='text'>Mais 3 cursos gratuitos de Python. Dessa vez no MIT:

A Gentle Introduction to Programming Using Python (de 2008)
Introduction to Electrical Engineering and Computer Science I (de 2009)
A Gentle Introduction to Programming Using Python (de 2010)

Os vídeos você encontra no Youtube.</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/4412278979658635910/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/aprenda-python-com-o-mit.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4412278979658635910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4412278979658635910'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/aprenda-python-com-o-mit.html' title='Aprenda Python com o MIT'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-3266223132559612462</id><published>2010-09-02T22:47:00.001-03:00</published><updated>2010-09-08T14:51:25.001-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curso'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Aprenda Python com um curso do Google</title><summary type='text'>Tem gente que ainda duvida que Python é uma linguagem muito usada.

Depois que li o texto Google Python Style Guide, tenho repassado para várias pessoas. Na seção "Background", está escrito que Python é a principal linguagem de script  usada pelo Google. Vale lembrar que o Guido van Rossum, criador da linguagem, também trabalha lá.

Recentemente descobri que o Google disponibilizou gratuitamente </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/3266223132559612462/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/aprenda-python-com-um-curso-do-google.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3266223132559612462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3266223132559612462'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2010/09/aprenda-python-com-um-curso-do-google.html' title='Aprenda Python com um curso do Google'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-5913759635089495448</id><published>2009-11-17T11:26:00.019-02:00</published><updated>2010-07-01T01:35:25.040-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exemplo'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Como gravar campos de largura fixa</title><summary type='text'>Eu gosto das listas Python Brasil e Django Brasil porque nelas o pessoal sempre ajuda os iniciantes, sem preconceito. Lá, todo mundo se lembra que não nasceu sabendo.

Esses dias surgiu uma dúvida na lista Django Brasil sobre como formatar um arquivo de saída com campos de largura fixa e, dando continuidade ao objetivo desse blog de fornecer dicas para iniciantes em Python, vou transcrever o que </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/5913759635089495448/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2009/11/como-gravar-campos-de-largura-fixa.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/5913759635089495448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/5913759635089495448'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2009/11/como-gravar-campos-de-largura-fixa.html' title='Como gravar campos de largura fixa'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-3444282119444818477</id><published>2009-11-16T19:13:00.006-02:00</published><updated>2010-07-01T01:42:13.461-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pegadinha'/><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Várias atribuições na mesma linha</title><summary type='text'>Há alguns dias eu enviei uma pergunta para a lista Python Brasil perguntando sobre estilo de inicialização de variáveis e recebi uma ótima dica.

Em Python é possível atribuir conteúdo às variáveis de dois modos:
a = b = ""
ou
a = ""
b = ""
A primeira forma é um atalho, né? Mais prática e sucinta, mas esconde uma pegadinha.
Se eu usar esse atalho com dicionários ou listas, por exemplo, veja o que</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/3444282119444818477/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2009/11/varias-atribuicoes-na-mesma-linha.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3444282119444818477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3444282119444818477'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2009/11/varias-atribuicoes-na-mesma-linha.html' title='Várias atribuições na mesma linha'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-4617282909999409014</id><published>2009-10-20T13:50:00.005-02:00</published><updated>2010-07-01T01:46:16.968-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>Atribuir conteúdo default a uma variável</title><summary type='text'>Normalmente, quando queremos checar se uma determinada variável está vazia para atribuir um conteúdo default a ela, fazemos assim:

if not minha_var:
    minha_var = 'default'

Existe um atalhozinho legal para isso:
minha_var = minha_var or 'default'

Aqui entra em ação os operadores lógicos do python, nesse caso, o or.

Para saber mais sobre esse assunto e também como funciona o and e o not, </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/4617282909999409014/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/atribuir-conteudo-default-uma-variavel.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4617282909999409014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/4617282909999409014'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/atribuir-conteudo-default-uma-variavel.html' title='Atribuir conteúdo default a uma variável'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-6393901080063452828</id><published>2009-10-15T15:49:00.007-03:00</published><updated>2010-07-01T01:50:02.185-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iniciante'/><title type='text'>filter() ou list comprehension?</title><summary type='text'>Eu postei na lista Python Brasil a seguinte pergunta:

Pessoal, bom dia.

Eu tenho uma lista retornada pela função re.split(r'(\w+)', s).

Para me livrar das ocorrências nulas, estou usando o seguinte comando:
partes = [t for t in re.split(r'(\w+)', s) if t]

No entanto, consigo o mesmo resultado se eu usar:
partes = filter(None, re.split(r'(\w+)', s))


O manual[1] diz que o filter() é </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/6393901080063452828/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/filter-ou-list-comprehension.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/6393901080063452828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/6393901080063452828'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/filter-ou-list-comprehension.html' title='filter() ou list comprehension?'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-1562585479900237640</id><published>2009-10-14T23:45:00.005-03:00</published><updated>2010-07-01T01:53:01.029-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='django'/><title type='text'>[django] Rodar script da linha de comando</title><summary type='text'>Todo site desenvolvido em Django tem uma configuração básica: o mapeamento de URLs para views, no arquivo urls.py.

E se eu precisar rodar alguma rotina que manipula o banco de dados via linha de comando do terminal? Esse mapeamento não vai me ajudar em nada, porque a rotina que vai rodar a partir do terminal não é uma view que vai mostrar algo usando um template.

Hoje eu me deparei com essa </summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/1562585479900237640/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/django-rodar-script-da-linha-de-comando.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1562585479900237640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/1562585479900237640'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/django-rodar-script-da-linha-de-comando.html' title='[django] Rodar script da linha de comando'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2240031811551496628.post-3069370132271809385</id><published>2009-10-13T08:39:00.017-03:00</published><updated>2010-03-26T02:20:17.879-03:00</updated><title type='text'>Como usar o SyntaxHighlighter</title><summary type='text'>Eu resolvi fazer uma revisão em alguns posts desse blog e vi que aquele que fala sobre o SyntaxHighlighter não diz nada sobre como usá-lo. :-(

Pois bem, vamos resolver essa falha e detalhar como ele funciona.

A função do SyntaxHighlighter é mostrar trechos de código com coloração de sintaxe e numeração de linha, nas páginas do seu site. Opcionalmente, podemos também mostrar uma régua de colunas</summary><link rel='replies' type='application/atom+xml' href='http://aprenda-python.blogspot.com/feeds/3069370132271809385/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/como-usar-o-syntaxhighlighter.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3069370132271809385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2240031811551496628/posts/default/3069370132271809385'/><link rel='alternate' type='text/html' href='http://aprenda-python.blogspot.com/2009/10/como-usar-o-syntaxhighlighter.html' title='Como usar o SyntaxHighlighter'/><author><name>Vinicius Assef</name><uri>http://www.blogger.com/profile/02352153394258072317</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/-5QtDiIvts5A/TouQO1V7GgI/AAAAAAAAAE4/q_HiTjq9QZ0/s220/eu-im2.jpg'/></author><thr:total>0</thr:total></entry></feed>
