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
➜ ~ sudo apt-get upgrade -y | |
Reading package lists... Done | |
Building dependency tree... Done | |
Reading state information... Done | |
Calculating upgrade... Done | |
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. | |
3 not fully installed or removed. | |
After this operation, 0 B of additional disk space will be used. | |
Setting up virtualbox-dkms (6.1.32-dfsg-1build1) ... | |
Removing old virtualbox-6.1.32 DKMS files... |
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
sair = 'Não' | |
while sair != 'Sim': | |
print("João 2l") | |
print("Pedro 5l") | |
print("José 10l") | |
j = int(input('Enter 1st number: ')) | |
p = int(input('Enter 2nd number: ')) | |
j = int(input('Enter 3nd number: ')) | |
print(2500) | |
print(5200) |
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 django.db import models | |
class Car(models.Model): | |
AT = 'AT' | |
MA = 'MA' | |
CAMBIO = [ | |
(AT, 'Automatic'), | |
(MA, 'Manual') | |
] |
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 requests import get | |
from parsel import Selector | |
url = 'https://www.pockettactics.com/deadly-sin-retribution/codes' | |
resp = get(url) | |
selector = Selector(text=resp.text) | |
for r in selector.css('.entry-content').css('ul'): |
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
Contexto | |
O objetivo desse dessa implementação é criar endpoints para gerenciar serviços que podem ser prestados dentro da plataforma. | |
Objetivo | |
Para isso, vamos criar um novo django app tanto na camada de APIs como na camada de backoffice. (São projetos diferentes). | |
Dentro do Django app, vamos criar o client_services. A tabela deve funcionar como uma grande | |
vitrine de serviços disponíveis para compra do usuário paciente. |
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/local/bin/python | |
# coding: utf-8 | |
import itertools | |
from collections import OrderedDict | |
from decimal import Decimal | |
import numpy as np | |
from html_table_parser.parser_functions import extract_tables, make2d | |
from requests import get, packages |
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 pathlib import Path | |
from openpyxl import load_workbook | |
open_file = 'alunos.xlsx' | |
# Essa linha abaixo eu digo pro scripts ir na pasta Desktop do windows e pegar o arquivo 'alunos.xlsx' | |
local_filename_open = Path.joinpath(Path.home(), Path("desktop"), open_file) | |
# Abre o arquivo e pega o conteúdo e coloca na variável 'planilha_1' | |
planilha_1 = load_workbook(local_filename_open) | |
open_file = 'alunos2.xlsx' |
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
<div class="container"> | |
<form action="{% url 'estados' %}" method="post"> | |
{% csrf_token %} | |
<select name="regiao_selecionada" id="regiao_selecionada"> | |
{% for indice, regioes in regioes.items %} | |
<option value="{{ regioes.id }}">{{ regioes.nome }}</option> | |
{% endfor %} | |
</select> | |
<button type="submit">Pesquisar</button> | |
</form> |
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 estados(request): | |
regiao_selecionada = request.POST['regiao_selecionada'] | |
api_estados = f'https://servicodados.ibge.gov.br/api/v1/localidades/regioes/{regiao_selecionada}/estados' | |
requisicao_estados = requests.get(api_estados) | |
lista = requisicao_estados.json() | |
dicionario_estados = {} | |
for indice, valor in enumerate(lista): | |
dicionario_estados[indice] = valor |
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 requests import get | |
url = 'https://cms-media-api.r7.com' | |
response = get(url) | |
for info in response.json(): | |
for info2 in info.items(): | |
print(f'{info2[0]} => {info2[1]}') | |
print(f'{"*"*100}') |
NewerOlder