- 建立起始介面
- 登入成功後要顯示的介面
步驟一: 先建立起始介面

輸入 1 時 :先印出 "登入功能"

輸入 2 時 :先印出 "註冊功能" 、 "登入功能"

輸入 3 時 才可以離開程式

參考程式碼:
import pymysql
conn = pymysql.connect(host='localhost',user='root',passwd='',db='my_python_db',charset='utf8')
cur = conn.cursor()
def myindex():
print("管理者登入系統")
print("*----------------*")
print("1.登入")
print("2.註冊帳號")
print("3.結束程式")
def create_staff():
print("註冊的方法")
def login_staff():
print("登入功能放這裡")
def mymenu():
while True:
myindex() #呼叫起始介面
num = int(input("請輸入您要執行的動作"))
print()
if num == 1 :
login_staff()
elif num == 2 :
create_staff()
elif num == 3 :
break #離開迴圈
#主程式
mymenu()
#關閉資料庫連線
cur.close()
conn.close()
登入成功後要顯示的介面
接著先做等等登入成功時要顯示的介面,並先執行看看,留著備用。

參考程式碼:
def myindex2():
print("請選擇您要做的項目")
print("*-------------*")
print("1.查詢所有員工的資料")
print("2.修改員工資料")
print("3.刪除員工的帳號")
print("4.離開")
myindex2()
Yiru@Studio - 關於我 - 意如