|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
Created on Thu Aug 30 16:05:57 2018
@author: GQS
功能:从txt内部提取两地时间、距离、以及将提取出的数据存到excel中,知道距离坐标
"""
import re
import xlsxwriter
def file2data(filename):
fr=open(filename)
lists=fr.readlines()
return lists
if __name__=='__main__':
data=file2data('TXT result.txt')
workbook = xlsxwriter.Workbook("result.xlsx")
worksheet = workbook.add_worksheet()
for k in range(len(data)):
a=re.findall(r"\d+\.?\d*",data[k])
worksheet.write(int(a[-2]),int(a[-1]), a[-3])
worksheet.write(int(a[-1]),int(a[-2]), a[-3])
worksheet.write(k,k, 0)
|
|