从文件中删除一些行 [英] To remove some lines from a file
问题描述
亲爱的,
我对python很新。我想从文件中删除两行。
文件以一些注释开头,注释符号为$。文件
结构是
$
$
$
$
$
$
$
..
.. < br $> b $ b ..
..
$
line1
line 2
$
$
..
..
..
$
实际命令
我想在
文件的最开头删除这两行两个评论块。我已经阅读了有关python的内容但是我的
库知识仍然很弱。那么请你帮我这个
代码。
我想称之为
myscript targetfile
我已经读过关于命令行参数的信息。也许我可以自己应付
但是也很感激帮助。
祝你好运,
。文件
结构是
Dear all,
I am quite new to python. I would like to remove two lines from a file.
The file starts with some comments, the comment sign is $. The file
structure is
$
$
$
$
$
$
$
..
..
..
..
$
line1
line 2
$
$
..
..
..
$
actual commands
I would like to delete those two lines at the very beginning of the
file between two comment blocks. I have read things about python but my
library knowledge is still weak. So could you please help me with this
code.
I would like to call this as
myscript targetfile
I have read sth about command line arguments. Perhaps I can cope with
that myself but help is also appreciated on that.
Best regards,
. The file
structure is
这篇关于从文件中删除一些行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!