TQC+ 網頁資料擷取與分析 Python 3 _ 105 受僱員工資料表

說明:
請撰寫一程式連結read.db資料庫,讀取Employee資料表,輸出Employee資料表內的資料。
檔案連結:read.db (請另存檔案,必須與程式同一資料夾)
範例輸出:
(1, '小陳', 1997, '新北市', 58000)
(2, '小范', 2000, '臺北市', 50000)
(3, '小施', 1999, '高雄市', 47000)
(4, '小吳', 1998, '台中市', 52000)
程式碼:
import sqlite3

con = sqlite3.connect('read.db')
cursor = con.cursor()
cursor.execute("SELECT * FROM Employee")

for i in cursor: print(i)

con.close()

沒有留言:

張貼留言