首页 > 代码库 > 文件换行
文件换行
ReadFile = [] User_Choice = int(input("请输入staff_id号:")) with open("Information","r",encoding="utf8") as read_file,open("NewInformation","w+",encoding="utf8") as write_file: for line in read_file: ReadFile.append(line.strip().split(",")) for each_line in ReadFile: if User_Choice == int(each_line[0]): ReadFile.remove(ReadFile[User_Choice]) for new_line in ReadFile: write_file.write(‘,‘.join(new_line).strip("")) write_file.write("\n") #写入这行,可使文件换行 os.remove("Information") os.rename("NewInformation","Information")
文件换行
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。