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
""" | |
Exibindo comentários em ordem cronológica reversa. | |
Os mais recentes aparecem primeiro. | |
https://docs.python.org/3/howto/sorting.html | |
""" | |
comentarios = [ | |
['2023-1-29 11:03:00',"Agora entendi o problema"], | |
['2023-1-29 11:04:01',"Quase finalizando"], | |
['2022-12-29 8:32:49',"Recebi sua mensagem"], | |
['2022-12-30 4:14:58',"Ainda não entendi o problema"], |
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 sys | |
try: | |
if sys.argv[1] in sys.argv: # Caso exista argumento 1 | |
match sys.argv[1]: | |
case "oi": | |
print("\nOlá pessoa!") | |
case "tchau": | |
print("\nTchau, até logo!") | |
case _: |
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 mysql.connector | |
mydb = mysql.connector.connect( | |
host="127.0.1.1", # ip do banco | |
user="usuario", | |
passwd="senha", | |
database="banco_glpi" | |
) | |
mycursor = mydb.cursor() |
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 maiuscula(funcao): | |
def wrapper(texto): # função que modifica | |
return funcao(texto.upper()) # transforma pra maiúscula | |
return wrapper # retorna a função modificadora | |
@maiuscula | |
def imprimir_mensagem(nome): | |
print(f"Olá {nome}, \nSeja bem vindo!") |
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 html.parser import HTMLParser | |
class Parser(HTMLParser): | |
# method to append the start tag to the list start_tags. | |
def handle_starttag(self, tag, attrs): | |
global start_tags | |
start_tags.append(tag) | |
# method to append the end tag to the list end_tags. |
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 bs4 import BeautifulSoup | |
html = 'lt;p><span style="font-weight: 400;">Você não teve o e-mail pessoal criado por falta de informações, para a criação você deve abrir um novo chamado com os seguintes dados:</span></p><p><strong>CPF -</strong></p><p><strong>NOME COMPLETO - </strong></p><p><strong>MATRÍCULA -</strong></p><p><strong>CARGO -</strong></p><p><strong>TELEFONE -</strong></p><p><strong>SETOR -</strong></p>' | |
soup = BeautifulSoup(html, 'html5lib') | |
print(soup.get_text()) |
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
# Checkout From Specific Git Commit ID | |
git log | |
# Copy the commit (SHA) id and checkout using the following command. | |
git checkout 28cd74decb47d8a5294eb59e793cb24a0f242e9e | |
# You can also use the short form of the SHA ID from the start, as shown below. |
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 webbrowser | |
webbrowser.open("https://github.com/eder-projetos-dev") |
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
### Instalando python3-venv | |
sudo apt install -y python3-venv | |
### Criando my_env | |
cd ~ |
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
# Criar o arquivo requirements com o freeze | |
pip freeze > requirements.txt | |
# Instalar as dependências utilizando o requirements | |
pip install -r requirements.txt |
OlderNewer