惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
L
LangChain Blog
GbyAI
GbyAI
F
Fortinet All Blogs
腾讯CDC
Last Week in AI
Last Week in AI
A
About on SuperTechFans
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky
B
Blog
D
Docker
G
Google Developers Blog
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
U
Unit 42
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed

博客园 - bigdog

安装PyTorch_1 Pandas上的Dataframe求差集 Linux 下安装NLTK的过程 Python函数返回多结果 Pandas下的Dataframe如何实现多条件筛选 将英文缩写扩展成正常英文的方法 如何安装pytorch Selenium 获取Select元素的选中值 安装MxNet Docker 的日常 Ubuntu上安装Docker Ubuntu华为云挂载新硬盘 Pandas中的DataFrame读取Mysql的方法 Pandas中的DataFrame读取Oracle的方法 Kettle 7.1 配置连接Oracle、Mysql、SqlServe的DLL文件准备 Nginx开启访问日志记录 Selenium chromeDriver 下载地址 在Linux上部署Nginx,反向代理tornado的WebSite Linux上安装Mysql
Python读写大文件-将整行文字根据分号分行
bigdog · 2020-04-28 · via 博客园 - bigdog
f = open("DDD_sales.txt", 'r', True)
filepath="data1.txt"
f1 = open(filepath, mode="a", encoding="utf-8")
line=""
ix=0
while True:
  # 每次读取一个字符
  ch = f.read(1)
  # 如果没有读到数据,跳出循环
  if not ch: break
  line= line+str(ch)
  if(ch==";"):
      ix=ix+1
      f1.write(str(line[0:len(line) - 1])+ "\n")
      f1.flush()
      print(str(ix))
      line=""
f1.close()
f.close()

posted @ 2020-04-28 17:20  bigdog  阅读(632)  评论(0)    收藏  举报