网络编程
位置:首页>> 网络编程>> Python编程>> Python删除n行后的其他行方法

Python删除n行后的其他行方法

作者:男神是巴卫  发布时间:2022-07-01 15:06:29 

标签:Python,删除,行

如下所示:


#!/usr/bin/python
#-*- coding: utf-8 -*-

fin=open('add_1.txt')
a=fin.readlines()
# print a
fout=open('ok.txt','w')
b=''.join(a[:3])
fout.write(b)

删除3行后的其他行。

来源:https://blog.csdn.net/baidu_33260220/article/details/78780048

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com