txt.file删除行 [英] txt.file remove lines

查看:110
本文介绍了txt.file删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助。

我有一个txt文件。这是一个商店的库存。每种格式的名称是aritgo,仓库中的位置和日期用;分隔。示例:计算机; 001; 10/02/2013

我的工作目标之一是选择一个项目并删除。我该怎么办?

I need help.
I have a txt file. which is an inventory of a store. The format of each is aritgo by name, location in the warehouse and date separated by ";". Example: Computer; 001; 10/02/2013
One aim of my work is to select an item and remove. How can I do?

推荐答案

没有直接从文件中删除行的方法。但是,您可能会逐行读取输入文件,仅将要维护的行复制到新文件。在该过程结束时丢弃原始文件并重命名新写入的文件。
There is no direct way for removing a line from a file. However you might read the input file line by line, copying to a new file only the lines you want to maintain. At the end of the process discard the original file and rename the freshly written one.


这篇关于txt.file删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆