网络编程
位置:首页>> 网络编程>> Python编程>> python读取txt文件 * 定位置字符的方法

python读取txt文件 * 定位置字符的方法

作者:weixin_39012047  发布时间:2022-07-02 17:38:52 

标签:python,txt,字符

如下所示:


# -*- coding:utf-8 -*-

import sys
reload(sys)
sys.setdefaultencoding('utf8')
fp = open("resources.txt", "r")
sample = fp.readlines()

file=open("test.txt", "w")

for line in sample:
sample_ = line.split('固定字符')
print(sample_[n])
file.write(sample_[n])
file.write('\n')

来源:https://blog.csdn.net/weixin_39012047/article/details/81328724

0
投稿

猜你喜欢

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