目标:从步长为1,提取步长为40的数据,存入 .txt 文件
code:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 26 07:35:28 2018
@author: luoluo
"""
f = open('2WI_PM_3DP.txt','r')
lines = f.readlines()
lines=lines[::26]
for line in lines:
print line
with open('select_2WI_PM_3DP.txt','w') as f:
for i in lines:
f.write(i)
参考:
https://jingyan.baidu.com/article/cbf0e500f77d542eab289343.html
https://blog.csdn.net/yinhonglei110/article/details/52860021