python 对text进行读写小例子非常简单
来源:互联网 发布:数据库分为哪几种类型 编辑:程序博客网 时间:2024/05/19 23:55
Description:After modifying the strings in one text,I rewrote them in another text. The following python code is effective.
Code:
# change pointnamesfileread = open("allpointnames.txt", 'r')name = []name1 = []for line in fileread: name.append(line)if name[len(name)-1][len(name[len(name)-1])-1] != "\n": name[len(name)-1] = name[len(name)-1]+"\n"print(name)fileread.close()print(len(name))for i in range(0, 100): #print(name[i][0]) s = str(2) + name[i][1:len(name[i])-1] +".net" +"\n" name1.append(s)print(name1)filew = open("0_99pointnamestrue.txt", 'w')for line1 in name1: filew.writelines(line1)filew.close()print(len(name1))
If you use this piece of code,you are supposed to pay attention to the enter key.
阅读全文
0 0
- python 对text进行读写小例子非常简单
- Python简单对文件进行读写操作
- python对文件进行读写
- DOM进行XML读写的简单例子
- 【Python】用python对excel进行读写
- 对cookies读写简单的例子
- python中对Excel进行读写操作
- python对文件进行读写操作
- python对文件进行读写操作
- python对文件进行读写操作
- python对文件进行读写操作
- python对文件进行读写操作
- python中对Excel进行读写操作
- python对文件进行读写操作
- 使用Python对Excel进行读写操作
- 一个关于时钟的非常简单的小例子
- C# 读取text内容并向text写入内容,对文本进行读写
- 【java】各种对文件,读写的方法及小例子
- 7.SpringBoot整合RabbitMQ实现微服务间的异步消息沟通
- openssl aes 加密解密示例程序
- GreenPlum 集群 gpfdist 实战
- 链表中倒数第K个节点
- codeforces 789A
- python 对text进行读写小例子非常简单
- C# 遍历Hashtable
- 二叉树的垂直遍历
- D3.js实现折线图的方法详解
- [leetcode: Python]566. Reshape the Matrix
- sql 笔记1
- Gerrit 安装过程中遇到的问题汇总。
- 关于截图工具的总结
- js上下无线滚动大法,跟跑马灯原理差不多