python崗位簡介表 python3 員工資訊表

2021-10-13 02:51:37 字數 3409 閱讀 1637

1 #!usr/bin/env/ python

2 #-*- coding:utf-8 -*-

3 #author: xiaofeng

4 importos5 li = ["id", "name", "age", "phone", "job"]6 flag =false7 staff_id =none8 number = "xiaofeng"

9 word = "123456"

12 deflogin(func):13 definner():14 globalflag15 if notflag:16 print("如想操作員工資訊,請先等錄:")17 account = input("請輸入您的賬號:").strip()18 password = input("請輸入您的密碼:").strip()19 if account == number and password ==word:20 flag =true21 print("登陸成功!")22 res =func()23 returnres24 else:25 print("賬號或密碼錯誤,登陸失敗!")26 else:27 res =func()28 returnres29 returninner30

32 defhandle(content_1):33 if "select" or "set" in content_1 and "where" incontent_1:34 info_start = content_1.index("t") + 1

35 info_end = content_1.index("where") - 1

36 info =content_1[info_start:info_end].strip()37 condition = content_1[info_end + 6:].strip()38 returninfo, condition39 else:40 print("輸入錯誤!")41

43 defseek():44 content = input("請輸入操作:(如select name, age where age>22)").strip().lower()45 if content.startswith("select") and "where" incontent:46 handle_str_1 =handle(content)47 out_list =48 for p inli:49 if p in handle_str_1[1]:50 if ">" in handle_str_1[1]:51 info_list = handle_str_1[0].split(",")52 str_info = " ".join(info_list)53 info_list = str_info.split() #去字串內空格

199 id_str =str(staff_id)200 final_str = id_str + "," + new_staff_str + "\n"

201 with open("staff_list", "a", encoding="utf-8") as f:202 f.write(final_str)203 print("您新增的資訊為:{}".format(final_str))204

206 @login207 defdelete():208 id_delete = input("請輸入要刪除員工的id號:")209 with open("staff_list", "r", encoding="utf-8") as f1, \210 open("staff_list_bak", "w", encoding="utf-8") as f2:211 for line inf1:212 if notline.isspace():213 line_list = line.strip().split(",")214 if id_delete ==line_list[0]:215 continue

216 f2.write(line)217 os.remove("staff_list")218 os.rename("staff_list_bak", "staff_list")219 print("刪除成功!")220

222 @login223 defmodify():224 content = input("請輸入要修改的內容(如set 列名=「新的值」 where id=x)").strip()225 handle_str =handle(content)226 info_list = handle_str[0].split(",")227 str_info = " ".join(info_list)228 info_list = str_info.split() #去字串內空格

229 index_2 = handle_str[1].index("=")230 character = handle_str[1][:index_2].strip()231 num = handle_str[1][index_2 + 1:].strip()232 ifnum.isdigit():233 num_int =int(num)234 with open("staff_list", "r", encoding="utf-8") as f1, \235 open("staff_list_bak", "w", encoding="utf-8") as f2:236 for line inf1:237 if notline.isspace():238 line_list = line.strip().split(",")239 character_value =int(line_list[li.index(character)])240 if num_int ==character_value:241 for c ininfo_list:242 index_1 = c.index("=")243 set_key =c[:index_1].strip()244 set_value = c[index_1 + 1:].strip()245 line_list[li.index(set_key)] =set_value246 line = ",".join(line_list)247 f2.write(line)248 os.remove("staff_list")249 os.rename("staff_list_bak", "staff_list")250 else:251 print("請輸入正確語句!")252

254 operate_list = ["查詢", "新增", "刪除", "修改"]255 whiletrue:256 print("-" * 50)257 for index, i inenumerate(operate_list):258 print(index, "\t", i)259 choice = input("請輸入您個的選擇編號:").strip()260 if choice.isdigit() and choice == "0":261 seek()262 elif choice.isdigit() and choice == "1":263 add()264 elif choice.isdigit() and choice == "2":265 delete()266 elif choice.isdigit() and choice == "3":267 modify()268 else:269 print("請按要求輸入編號")

Python崗位分析報告

根據分析結果發現,現在的公司招聘的員工大部分都是需要1 5年的工作經驗,但是也有一些是留給新人的。根據分析結果發現,現在公司招聘一般都要求本科學歷,雖然大專及以下也有但是很少。根據分析結果發現,python崗位需求數量北京排名第一,上海排名第二 主要是金融行業 深圳排名第三,杭州超過了廣州。根據分析...

非程式設計師崗位的職場人該學習C 還是Python

首先,對於非程式設計師的職場人來說,在當前的時代背景下,選擇學習python更適合一些,原因有三點,其一是python的應用場景更多 其二是python簡單易學 其三是python未來有廣闊的應用前景。從技術體系結構來看,c 語言是比較典型的物件導向程式設計語言,特點是有優秀的執行效能,目前在作業系...

python實現約瑟夫 約瑟夫問題python實現

python語言之如何實現約瑟夫環問題 def josephus n,m if type n 60個人從1開始編號每人拿乙個號碼牌排成圈,從 1開始報數,第一次報數 totalnum 猴子總數 startnum 開始序號 intervalnum 間隔數def kingelect totalnum,s...