数据:

对txt文件进行数据处理:

txt_file_path = "basic_info.txt"
write_txt_file_path = "basic_info1.txt"
def write_txt_file():
if os.path.exists(txt_file_path) is False:
return
with open(txt_file_path,'r') as r_file:
for row in r_file:
list = row.split("\t")
# print("用\\t分割行的结果:{}".format(list))
# print("待分割的列:{}".format(list[2]))
col = list[2]
res = col[2:-2].split('|')
# print("对此列进行分割的结果:{}".format(res))
#将分割结果写入新的文件中
with open(write_txt_file_path,'a') as w_file:
w_file.write(' '.join(res))
w_file.write('\n')
#break if __name__ == "__main__":
write_txt_file()

  

最新文章

  1. 高性能JavaScript--加载和执行(简要学习笔记一)
  2. 【JWT】JWT+HA256加密 Token验证
  3. "递归"实现"约瑟夫环","汉诺塔"
  4. Step deep into GLSL
  5. 13款精彩实用的最新jQuery插件
  6. BZOJ 1560 火星藏宝图(DP)
  7. Visual Assist X在Windows 8.1下出现中文乱码的解决方法
  8. hdu_5719_Arrange(脑洞题)
  9. java特征
  10. 随机采样和随机模拟:吉布斯采样Gibbs Sampling实现高斯分布参数推断
  11. 机器学习入门18 - 生产机器学习系统(Production ML Systems)
  12. 读取Excel,单元格内容大于255个字符自动被截取的问题
  13. 2019.4.24 一题(CF 809E)——推式子+虚树
  14. vc++ openssl 程序签名
  15. HTML学习总结(作业五)
  16. Unity 多人网络连接
  17. LeetCode 976 Largest Perimeter Triangle 解题报告
  18. 2018.12.31 bzoj3771: Triple(生成函数+fft+容斥原理)
  19. virtualenv虚拟环境安装不同版本的django
  20. java classpath作用

热门文章

  1. iOS开发-真机调试遇到“The executable was signed with invalid entitlements.
  2. Python中.npz文件的读取
  3. win10上安装mysql8(installer方式)并创建用户开启远程连接
  4. 【原】nginx配置文件
  5. 什么是Device ID?
  6. cookie、session、localStorage、sessionStorage的区别
  7. 使用mybase、Typora搭配坚果云实现个人云笔记
  8. 2016 年 31 款轻量高效的开源 JavaScript 插件和库
  9. 你知道HTTP协议的ETag是干什么的吗?
  10. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 按钮:用于要弹出信息的按钮