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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
from random import randint | |
from requests import get | |
from json import loads | |
url = 'http://dabsistemas.saude.gov.br/sistemas/sadab/js/buscar_cpf_dbpessoa.json.php?cpf=' | |
saida = 'N: {5}\nNome: {0}\nMãe: {1}\nSexo: {2}\nNacimento: {3}\nCPF: {4}' |
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 random import randint | |
from collections import namedtuple, Counter | |
num_info = namedtuple('num_info', 'numberr occurrences length'.split()) | |
def get_ten() -> list: | |
""" | |
Função que pega 10 números aleatórios entre 0 e 5000 |
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 smtplib | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
msg = MIMEMultipart('alternative') | |
msg['Subject'] = "ASSUNTO" | |
msg['From'] = "[email protected]" | |
msg['To'] = "[email protected]" | |
text = "Olá Python" |
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
""" | |
Stream to functions | |
""" | |
from os import listdir | |
def read_file(arq): | |
with open(arq) as _file: |
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 unittest import TestCase, main | |
def nama_req(val): | |
return 'Nama Team' if val % 35 == 0 \ | |
else 'Nama' if val % 5 == 0 \ | |
else 'Team' if val % 7 == 0 \ | |
else val | |
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 time import sleep | |
from random import choice, randint | |
from os import system, name | |
# Modelo: 'Nome': [Ataque, Defesa, Vida] | |
dex = {'Narf': [20, 30, 60], 'Jomander': [50, 30, 40], | |
'Squirtle': [30, 50, 40], 'Bulbassauro': [40, 50, 30], | |
'Pikachu': [60, 50, 40], 'Hage-Monstro': [50, 50, 70], | |
'Hitmon-Jorge': [55, 25, 40], 'Toranxu': [35, 15, 60], | |
'Alex': [35, 15, 60], 'Gokuma': [35, 15, 60], |
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 threading import Thread | |
from os import listdir | |
def list_print(path: str) -> None: | |
""" | |
Executa um listdir e printa. | |
Args: | |
path: diretório a ser aplicada a função listdir |
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 multiprocessing.dummy import Pool | |
from os import listdir | |
def list_print(path: str) -> tuple: | |
""" | |
Executa um listdir e retorna uma tupla com o path e os arquivos. | |
Args: | |
path: diretório a ser aplicada a função listdir |
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 monta_matriz(chave): | |
alfabeto = list("abcdefghiklmnopqrstuvwxyz") | |
matriz = [[0, 0, 0, 0, 0] for x in range(5)] | |
linha, coluna, posicao = 0, 0, 0 | |
# Indica a posição na matriz usando AM. | |
for letra in chave: | |
linha = int(posicao / 5) # Na primeira [0] -> [1] ..... [5] |
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 operator import add |
OlderNewer