python中如何将txt中多列数据表示成时间
数据:('00','00','00.83')('00','00','01.87')('00','00','02.87')('00','00','03.87')('00',...
数据:
('00', '00', '00.83')
('00', '00', '01.87')
('00', '00', '02.87')
('00', '00', '03.87')
('00', '00', '04.92')
('00', '00', '06.05')
('00', '00', '07.79')
('00', '04', '32.35')
('00', '04', '33.36')
('00', '04', '34.36')
('00', '04', '35.36')
('00', '47', '25.98')
('01', '51', '49.58')
('01', '51', '50.58')
('01', '51', '51.58')
('01', '51', '52.58')
('01', '51', '53.58')
我尝试用这样的代码:
import datetime
with open ('b.txt','r') as rf:
for line in rf:
t=datetime.time()
print (t)
结果:
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
qaq新手求解
预计结果:
00:00:00.83
00:00:01.87
00:00:02.87 展开
('00', '00', '00.83')
('00', '00', '01.87')
('00', '00', '02.87')
('00', '00', '03.87')
('00', '00', '04.92')
('00', '00', '06.05')
('00', '00', '07.79')
('00', '04', '32.35')
('00', '04', '33.36')
('00', '04', '34.36')
('00', '04', '35.36')
('00', '47', '25.98')
('01', '51', '49.58')
('01', '51', '50.58')
('01', '51', '51.58')
('01', '51', '52.58')
('01', '51', '53.58')
我尝试用这样的代码:
import datetime
with open ('b.txt','r') as rf:
for line in rf:
t=datetime.time()
print (t)
结果:
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
00:00:00
qaq新手求解
预计结果:
00:00:00.83
00:00:01.87
00:00:02.87 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询