This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:UTF-8 -*- | |
import sqlite3 | |
conn = sqlite3.connect('meubanco.db') | |
conn.text_factory = str | |
cursor = conn.cursor() | |
# cria a tabela no banco de dados | |
# é necessário um try pois depois da primeira | |
# execuçaõ do script a tabela já vai estar criada |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:UTF-8 -*- | |
from collections import namedtuple | |
import csv | |
def devolve_livro(codigo): | |
"""Remove um livro do arquivo csv. Retorna uma lista | |
dos livros que ainda estão emprestados. | |
Args: | |
codigo (str): Codigo do livro para remover removido |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ladroes = set(['lula', 'dilma', 'pt']) | |
tempo = set(['clima', 'tempo', 'temperatura']) | |
pets = set(['gato', 'cachorro', 'papagaio']) | |
frase = 'eu gosto do clima' | |
frase_set = set(frase.split()) | |
for s in [ladroes, tempo, pets]: | |
if s & frase_set: | |
print 'Encontrei a string que procurava' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Static spekaer page generator for www.conadev.com | |
Author: Raphael Passini <raphapassini[at]gmail[dot]com> | |
""" | |
from jinja2 import Template | |
from slugify import slugify | |
html = open('speaker-template.html', 'r').read() |
NewerOlder