This file contains 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
from urllib.parse import urlparse, parse_qs | |
def video_id(value): | |
"""Video ID from youtube, vimeo and facebook links | |
>>> video_id('http://youtu.be/SA2iWivDJiE') | |
'SA2iWivDJiE' | |
>>> video_id('http://www.youtube.com/watch?v=_oPAwA_Udwc&feature=feedu') | |
'_oPAwA_Udwc' |
This file contains 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
import urllib.request | |
import re | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/5’ | |
} | |
req = urllib.request.Request(url, headers=headers) | |
with urllib.request.urlopen(r) as response: | |
html = response.read().decode(‘utf-8’) | |
preco = re.findall(r'<input type="hidden" value="(.*)" id="taxa-comercial">', html)[0] | |
print(preco) |
This file contains 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
import math | |
def utm_to_latlng(easting, northing, zone=25, northernHemisphere=False): | |
if not northernHemisphere: | |
northing = 10000000 - northing | |
a = 6378137 | |
e = 0.081819191 | |
e1sq = 0.006739497 |
This file contains 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
import turtle | |
def letra_o(pen, x, y): | |
pen.up() | |
pen.goto(x, y) | |
pen.down() | |
pen.goto(x, y + 100) | |
pen.goto(x + 50, y + 100) | |
pen.goto(x + 50, y) |
This file contains 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
numero = input("Quantos contatos quer cadastrar? ") | |
numero = int(numero) | |
contador = 0 | |
emails = [] | |
nomes = [] | |
telefones = [] | |
while contador < numero: |
This file contains 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
import random | |
def gerar_dado(): | |
faces = input("Digite o número de faces: ") | |
faces = int(faces) | |
print("Simulador de Dados: ", random.randint(1, faces)) | |
contador = 0 | |
dados = input("Quantos dados vocês quer? ") |
This file contains 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
import random | |
numero = random.randint(1, 100) | |
contador = 0 | |
while contador < 5: | |
print("Tentativa de número: ", contador) | |
chute = input("Digite um chute: ") |
This file contains 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
#deb cdrom:[LE 5.0 _le5/escola_ - Release i386 (20130421)]/ precise main restricted | |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
# newer versions of the distribution. | |
deb http://br.archive.ubuntu.com/ubuntu/ precise main restricted | |
deb-src http://br.archive.ubuntu.com/ubuntu/ precise main restricted | |
## Major bug fix updates produced after the final release of the | |
## distribution. | |
deb http://br.archive.ubuntu.com/ubuntu/ precise-updates main restricted |
This file contains 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 os | |
DEBUG = True | |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
DATABASES = { | |
'default': { |
This file contains 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
def minha_view(request): | |
marca = request.GET.get("marca", "") | |
if marcar: | |
context["brands_list"] = Post.objects.filter(is_active=True, brands__exact='MARCA01').order_by('created_date') | |
else: | |
context["brands_list"] = Post.objects.filter(is_active=True).order_by('created_date') |
NewerOlder