There is a list of attendance staff, each time to increase the deletion of staff too troublesome, find python simple write a script to manage,
01, the implementation of personnel additional operations
# Add AMD Delete card #coding =utf-8wfile=open (' Account.dat ') readfile=wfile.read () print "Please enter the new membership information. "Print" Membership information such as: C07004,DDDD, torpor, 2,020353,,,,,,,,,, "print" C07004: Membership number "print" DDDD: company abbreviation "print" torpor: member name "print" 2: Department " Print "020353, Time Card number" print "must be followed by 10,,,,,,,,,," Infile=raw_input (' Please enter new members: ') out=open (' Account.dat ', ' W ') Out.write ( Readfile+ ' \ n ') #out. Write ("\ n") Out.writelines ([Infile.strip ()]) Out.close ()
02, implement query Delete function
#delete Card#coding=utf-8import Shutildela = raw_input (' Please enter the Employee: ') with open (' Account.dat ', ' R ') as F:with open (' test.t Xt.new ', ' W ') as G:for line in F.readlines (): If Dela not in Line:g.write ( Line) shutil.move (' test.txt.new ', ' Account.dat ')
python-01, automatically write files