従業員管理情報の削除・増加機能
9859 ワード
# ##
# 1. , 3 :
# 1.select name ,age from staff_table where age>22
# , 22
# 2.select * from staff_table where dept = "it"
# “it”
# 3.select * from staff_table where enroll like "2013"
# “2013”
# 4. , ,
# 2. , phone ,staff_id
# 3. , id
# 4. , :
# update staff_table set dept = “Market” where dept = “IT”
# stafftable dept="Market", ="IT"
##
EmployeesList = []
def CirculationList(ReaDinG):
for ReaDLine in ReaDinG:
ReaDList = ReaDLine.strip("
").split(",")
EmployeesList.append(ReaDList)
# print(ReaDList)
def list_():
print(" \t \t\t \t \t \t \t\t ")
for Employees in EmployeesList:
print("%s\t\t%s\t\t%s\t\t %s\t\t%s\t\t%s\t %s" % (Employees[0],
Employees[1],
Employees[2],
Employees[3],
Employees[4],
Employees[5],
Employees[6]))
##
ReaDing = open("file_1.txt","r",encoding="utf-8")
ReaDinG = ReaDing.readlines()
ReaDList = CirculationList(ReaDinG)
ReaDing.close()
n = 0
while n<1:
list_()
print("*"*65)
print(" / / / ")
EmployeesInput = input(" ->")
if EmployeesInput == " ":
print(" / /2013")
elif EmployeesInput ==" ":
serialNumber = "G%d"% (len(EmployeesList)+ 1)
nameIn = input(" :-》")
genderIn = input(" :-》")
ageIn = input(" :-》")
jobIn = input(" :-》")
phoneIn = input(" :-》")
dateIn = input(" :-》")
creator = [serialNumber,nameIn,genderIn,ageIn,jobIn,phoneIn,dateIn]
EmployeesList.append(creator)
print(" %s" % nameIn)
continue
elif EmployeesInput ==" ":
nameInr = input(" :")
for NameInr in EmployeesList:
i = 0
if NameInr[1] == nameInr:
print(NameInr[1])
EmployeesList.remove(NameInr)
Reaing = open("file_1.txt", "w", encoding="utf-8")
for ReainG in EmployeesList:
ReanG = ','.join(ReainG)+"
"
Reaing.write(ReanG)
Reaing.close()
break
i += 1
else:##
pass
n+=1
転載先:https://www.cnblogs.com/ArtisticMonk/p/8933531.html