Python?? ??? SQLite ????? ??? ??
???? ????? ???? ?? ?? ????? ?? ???? SQLite? ? ??? ???? ??? ????. ? ??????? ???? ???? ?? ???? ??? ? ??? ??? ??????? ???? ?? Python ??????? ?????.
? ??? ??? ?? ??? ?? ? ????.
- SQLite ??????? ???? ?????.
- ??? ????? ??? ?????.
- ?? ??? ?? ???? ?????.
1. ?????? ? ??? ??
SQLite ?????? ??? ???? books ???? ???? ??? ??? ?????. ? ??? ??, ??, ISBN, ?? ?? ? ??? ?? ??? ????.
import sqlite3 import os def create_library_database(): """Creates the library database if it doesn't already exist.""" db_name = "library.db" if not os.path.exists(db_name): print(f"Creating database: {db_name}") conn = sqlite3.connect(db_name) cursor = conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS books ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, author TEXT, isbn TEXT UNIQUE, published_date DATE, genre TEXT ) ''') conn.commit() conn.close() else: print(f"Database already exists: {db_name}")
??????? ?????? ?? ??? ?????.
create_library_database()
??? ?? ??? ??? ?? ? ???? ??? library.db ??? ???? ????? ?????.
- ??????? ?? ??
??? ??? ? isbn ??? ???? ?? ??? ???? ??? ??? ???. ??? ???? ???? ?? SQLite? INSERT OR IGNORE ?? ???????.
?? ?? ??? ??? ????.
def insert_book(book): """ Inserts a book into the database. If a book with the same ISBN already exists, the insertion is ignored. """ conn = sqlite3.connect("library.db") cursor = conn.cursor() try: # Insert the book. Ignore the insertion if the ISBN already exists. cursor.execute(''' INSERT OR IGNORE INTO books (title, author, isbn, published_date, genre) VALUES (?, ?, ?, ?, ?) ''', (book["title"], book["author"], book["isbn"], book["published_date"], book["genre"])) conn.commit() if cursor.rowcount == 0: print(f"The book with ISBN '{book['isbn']}' already exists in the database.") else: print(f"Book inserted: {book['title']} by {book['author']}") except sqlite3.Error as e: print(f"Database error: {e}") finally: conn.close()
? ??? INSERT OR IGNORE SQL ?? ???? ?? ??? ????? ????? ???.
?3. ?? ?? ??
?????? ?? ???? insert_book ??? ???? ?????.
books = [ { "title": "To Kill a Mockingbird", "author": "Harper Lee", "isbn": "9780061120084", "published_date": "1960-07-11", "genre": "Fiction" }, { "title": "1984", "author": "George Orwell", "isbn": "9780451524935", "published_date": "1949-06-08", "genre": "Dystopian" }, { "title": "Pride and Prejudice", "author": "Jane Austen", "isbn": "9781503290563", "published_date": "1813-01-28", "genre": "Romance" } ] for book in books: insert_book(book)
? ??? ???? ?? ??? ??????? ?????. ?? ???? ??? ?? ???? ?????.
The book with ISBN '9780061120084' already exists in the database. The book with ISBN '9780451524935' already exists in the database. The book with ISBN '9781503290563' already exists in the database.
4. ?? ??
??????? ???? ?? ???? ??? ? ????. ?? ??, ???? ?? ?? ?? ?????:
def fetch_all_books(): conn = sqlite3.connect("library.db") cursor = conn.cursor() cursor.execute("SELECT * FROM books") rows = cursor.fetchall() conn.close() return rows books = fetch_all_books() for book in books: print(book)
??
?? Python ? ?? ??? ??? ????? ?? ???? ??? ???? ??? ? ?? ???? ????? ???? ????. SQLite? INSERT OR IGNORE? ?? ?? ??? ????? ??? ?? ???? ????? ??? ??? ?????.
??? ?? ???? ? ????? ???? ?????.
- ???? ???? ?? ?????.
- ?? ??? ???? ????.
- ?? ??.
???? ??? ?? ?????? ?
? ??? Python?? ??? SQLite ????? ??? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











Python? Unittest ? Pytest? ??? ? ???? ??, ?? ? ??? ????? ? ?? ?? ???? ??? ??? ?????. 1. ??? ??? ?? ??? ???? ??? ??? ??? ?????. UnitTest? ??? ??? ???? ???? Test \ _? ???? ???? ?????. Pytest? ? ?????. Test \ _?? ???? ?? ? ??????. 2. ??? ?? ?? ? ?? ? ??? ??? ????. UnitTest? Assertequal, AssertTrue ? ?? ??? ???? ?? Pytest? ??? Assert ?? ???? ?? ?? ??? ???? ?????. 3. ?? ??? ?? ? ?? ????? ????? ????.

pythonisidealfordataanalysisduetonumpyandpandas.1) numpyexcelsatnumericalcomputationsfast, multi-dimensionalArraysandectorizedOferationsLikenp.sqrt ()

?? ????? (DP)? ??? ??? ? ??? ?? ??? ??? ??? ? ??? ??? ?? ??? ???? ??? ????? ??????. ? ?? ?? ??? ????. 1. ??? (??) : ??? ?? ??? ???? ??? ???? ?? ??? ??????. 2. ??? (?) : ?? ???? ???? ????? ?????. ???? ???, ?? ?? ?? ?? ??/?? ?, ??? ??? ?? ?? ?? ??? ??? ????? ?????. ?????? ????? ?? ???? ?? ??? ? ???, ?? ??? ???? ?? ?? ??? ???? ??? ???? ????? ???? ???????.

??? ?? ???? ????? ????? __iter_ ? __next__ ???? ???????. ① __iter__ ???? ??? ? ?? ??? ???? ??? ?? ?? ??? ?????. ② __next__ ???? ? ??? ?? ????, ?? ??? ??? ????, ? ?? ??? ??? stopiteration ??? ??????. status ??? ???? ??????? ?? ??? ??? ?? ?? ??? ???????. pile ?? ?? ???? ?? ??? ?? ? ??? ?? ? ??? ?????? ?????. simple ??? ??? ?? ?? ??? ?? ???? ???? ?? ??? ? ??? ?? ????? ???? ??? ??? ???????.

Python? ?? ???? ?? ???, ?? ?? ????, ?? ???? ?? ? AI/ML ??? ???? ??? ?????. ??, Cpython? ???? ????? ?? ??, ?? ?? ??? ? ?? ? ?? ??? ?? ??? ??????. ??, ??? ????? ?? ?? ? ?? ??? ????? ?? ?? ? ? ??? ?? ?????. ??, Pyscript ? Nuitka? ?? ?? ???? ??? ??? ?? ??? ?????. ?????, AI ? ??? ?? ??? ?? ???? ??? ?? ???????? ???? ?? ? ??? ?????. ??? ??? Python? ??? ??? ????? ???? ?? ??? ???? ??? ?????.

Python? ?? ??? ???? ?????? ????, ????? ? ?? ??????? ???? ? ??? ??? ???? ?? ??? ?????. ?? TCP ??? ????? Socket.Socket ()? ???? ??? ??? ?? ? ??? ????? .listen ()? ???? ??? ?? .accept ()? ?? ????? ??? ???????. TCP ?????? ????? ?? ??? ??? ??? ????? .connect ()? ?? ? ?? .sendall ()? ???? ???? ??? .recv ()? ?? ??? ??????. ?? ?????? ????? 1. ??? : ??? ??? ? ???? ??? ? ????. 2. ??? I/O : ?? ??, Asyncio ?????? ? ??? ??? ?? ? ? ????. ???? ? ?

???? Python ?? ?? ?????? ?? ????, "??? ?????, ?? ??"? ???? ??? ??? ??? ?? ??? ?????. 1. ???? ?? ? ??? ?? ?????. ?? ???? ?? ??? ???? ??? ? ? ????. ?? ??, Spoke () ?? ???? ??? ??? ?? ??? ?? ????? ?? ??? ??? ????. 2. ???? ?? ???? ??? ??? ?????? Draw () ???? ???? ????? ?? ???? ?? ??? ???? ??? ???? ?? ?? ?? ??? ????? ?? ?? ????? ?? ?????. 3. Python ?? ???? ???????. ?? ???? ??? ???? ?? ???? ??? ????? ??? ?? ???? ??? ???? ????. ??? ??? ??? ???? ? ??? "?? ??"??????. 4. ???? ? ???? ?? ??? ?????

Python List ????? ?? ?? ??? [Start : End : Step] ??? ????? ??? ???? ????. 1. ?? ????? ?? ??? ?? [start : end : step]???. ??? ?? ??? (??), ?? ? ??? (???? ??)?? ??? ?? ?????. 2. ????? ???? 0?? ????? ???? ????? ??? ??? ???? ????? ??? 1? ??????. 3. my_list [: n]? ???? ? ?? n ??? ?? my_list [-n :]? ???? ??? n ??? ????. 4. My_List [:: 2]? ?? ??? ?? ?? ??? ???? ??? ??? ?? ?? ?? ??? ???? ? ????. 5. ???? ???? ? ???? ???? ????
