#查询函数def InquirefilelocationInquire_locationtarget with openfiler as fp lineslen=lenfpreadlines fpseeklocation #查询账号 flag=True for i in rangelineslen-1
#修改函数 def Modify(file,location,Inquire_location,target,new_info): with open(file,'r+') as fp: lineslen=len(fp.readlines()) fp.seek(location) #查询账号 flag=True for i in range(lineslen-1): #提取储存的账号 line=fp.readline() verify_target=[] counting=0 for j in line: if j==',': counting=counting+1 if j!=',' and counting==Inquire_location: verify_target.append(j) verify_the_target=verify_target[0] for j in range(1,len(verify_target)): verify_the_target=verify_the_target+verify_target[j] if verify_the_target==target: flag=False fp.seek(location+i*(len(line)+1)) fp.write(new_info+'\n') return True if flag: print('未查找到') return Fals
原文地址: https://www.cveoy.top/t/topic/hc0k 著作权归作者所有。请勿转载和采集!