Różnice
Różnice między wybraną wersją a wersją aktualną.
| Poprzednia rewizja po obu stronach Poprzednia wersja Nowa wersja | Poprzednia wersja | ||
| programowanie:python:start [2024/09/09 06:39] – sases | programowanie:python:start [2024/10/09 19:18] (aktualna) – sases | ||
|---|---|---|---|
| Linia 1: | Linia 1: | ||
| ====== Python ====== | ====== Python ====== | ||
| + | \\ | ||
| + | |||
| + | ===== Środowisko wirtualne ===== | ||
| + | * Utworzenie i uruchomienie | ||
| + | < | ||
| + | python -m venv env | ||
| + | source env/ | ||
| + | </ | ||
| + | |||
| + | * Opuszczenie | ||
| + | < | ||
| + | deactivate | ||
| + | </ | ||
| + | \\ | ||
| \\ | \\ | ||
| Linia 57: | Linia 71: | ||
| | ValueError | Raised when there is a wrong value in a specified data type | | | ValueError | Raised when there is a wrong value in a specified data type | | ||
| | ZeroDivisionError | Raised when the second operator in a division is zero | | | ZeroDivisionError | Raised when the second operator in a division is zero | | ||
| + | \\ | ||
| + | \\ | ||
| + | ===== MySQL ===== | ||
| + | Instalacja biblioteki: '' | ||
| + | Oficjalna dokumentacja: | ||
| + | Przykład: | ||
| + | <code python> | ||
| + | DB_CONFIG = { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | |||
| + | db = mysql.connector.connect(**DB_CONFIG) | ||
| + | cursor = db.cursor(buffered=True) | ||
| + | |||
| + | cursor.execute(f" | ||
| + | result = cursor.fetchall() | ||
| + | result = cursor.fetchone() | ||
| + | cursor.close() | ||
| + | |||
| + | sql = " | ||
| + | val = (' | ||
| + | cursor.execute(sql, | ||
| + | db.commit() | ||
| + | added_id = cursor.lastrowid | ||
| + | |||
| + | db.close() | ||
| + | </ | ||
| \\ | \\ | ||
| \\ | \\ | ||
| ===== Obiektowo ===== | ===== Obiektowo ===== | ||
| - | W Python nie ma czegoś takiego jak prywatne/ | + | W Python nie ma czegoś takiego jak prywatne/ |
| <code python> | <code python> | ||