当前位置:网站首页>TXT文本内容逐个删除
TXT文本内容逐个删除
2022-04-22 05:40:00 【Mr.RickyChen】
#! encoding:utf-8
'''''''''
TXT文本处理,
优惠券码,每次使用一个优惠券码就将使用的券码删除
'''
def read_coupon(FilePath):
with open(FilePath, 'r',encoding='utf-8') as old_file:
with open(FilePath, 'r+',encoding='utf-8') as new_file:
current_line = 0
for i in range(1):
j = i - 1
while current_line < (j - 1):
old_file.readline()
current_line += 1
seek_point = old_file.tell()
new_file.seek(seek_point, 0)
old_file.readline()
next_line = old_file.readline()
while next_line:
new_file.write(next_line)
next_line = old_file.readline()
new_file.truncate()
版权声明
本文为[Mr.RickyChen]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_42116406/article/details/99713902
边栏推荐
- Layer closes the pop-up window and refreshes the parent page
- golang 合并两个有序的数组(笔试题)
- TCGA数据库ensembl id 转为 gene Symbol,提取出需要的RNA种类表达谱列表信息
- Missile interception problem (DP, Dilworth theorem)
- Langue C - 100 questions classiques
- Summary of SQL interview questions (under update)
- uniapp:HBuilderX运行uniapp项目到夜神模拟器
- 蓝桥杯31天冲刺 Day18
- Alist简单使用指南
- B/S架构
猜你喜欢
随机推荐
redis:redis-cli不是内部或外部命令
PyQT5总结
LeetCode 467. Dynamic programming -- the only substring in the surrounding string
Torch uses stepping on the pit diary and matrix to speed up the operation
《最优化理论》:运输问题(一)求最小运费【西北角法、最小元素法、伏格尔法】
golang 合并两个有序的数组(笔试题)
CONDA command
蓝桥杯31天冲刺 Day8
IDEA常用快捷键
Three lines of recursive output code of stack C
Musk updates wechat push (Dog Coin)
Torch recurrent neural network nn. RNN () and torch nn. RNNCell()
Convolutional neural network
判断链表是否有环(集合&快慢指针)
Cytoscape安装教程
06-数据类型
uniapp:HBuilderX运行uniapp项目到夜神模拟器
Langue C - 100 questions classiques
Full Permutation (backtracking) template
Golang learning and school recruitment experience









