- Jul 15 Mon 2024 00:41
-
網頁設計 CentOS 8 的 firefox can't play youtube 影片
- Jul 13 Sat 2024 17:39
-
網頁設計 透過glob scandir readdir獲得資料夾內的檔案列表
- Jul 13 Sat 2024 12:16
-
網頁設計 CKeditor 4.11.1 網頁編纂器與CKfinder 2.6.2.1 圖片上傳PHP5.4利用
- Jul 13 Sat 2024 04:57
-
網頁設計 Line 熱點若何申請
- Jul 13 Sat 2024 00:25
-
若何刪除LINUX下收受接收桶的檔案並釋放空間 網頁設計
- Jul 10 Wed 2024 16:49
-
opencart 3.0.2 升級到 4.0.2.3 步調與問題
- Jul 10 Wed 2024 13:10
-
網頁設計 若何封閉 GDM 及 nouveau 並安裝 NVIDIA VGA驅動
- Jul 09 Tue 2024 06:15
-
若何在CentOS 8 安裝Anaconda3 及PyCharm
- Jul 09 Tue 2024 05:36
-
Python 利用 MySQL Connector 操作 MySQL MariaDB 資料庫教授教養與規範

網頁設計
- import mysql.connector
- from mysql.connector import Error
- try:
- # 連接 MySQL/MariaDB 資料庫
- connection = mysql.connector.connect(
- host='localhost', # 主機名稱
- database='officeguide_db', # 資料庫名稱
- user='officeguide', # 帳號
- password='your_password') # 暗碼
- # 查詢資料庫
- cursor = connection.cursor()
- cursor.execute("SELECT name, age FROM persons;")
- # 取回全部的資料
- records = cursor.fetchall()
- print("資料筆數:", cursor.rowcount)
- # 列出查詢的資料
- for (name, age) in records:
- print("Name: %s, Age: %d" % (name, age))
- except Error as e:
- print("資料庫連接失敗:", e)
- finally:
- if (connection.is_connected()):
- cursor.close()
- connection.close()
- print("資料庫連線已關閉")
複製代碼
- Jul 09 Tue 2024 01:18
-
ESP32 用Arduino程式上傳測試HelloWorld 網頁設計
- Jul 08 Mon 2024 12:09
-
Arduino初始設定ESP32出現package_esp32_index.json毛病










