0
I have a relatively large file of data, which I removed from a time-stamping machine, but it comes in the following way:
00003000527005792012635570932000219305130720170713
00003000527005792012635570932000219305130720170713
I would like to separate this data into columns so that I can export to Excel:
00003000527005792 - numero de serie do relógio | 012635570932 - Numero do PIS | 000219305 - NSR |13 - dia | 07 - Mês | 2017 - Ano |07 - hora |13 - minuto
Thus remaining:
00003000527005792 012635570932 000219305 13 07 2017 07 13
Well, so far I’ve been able to read the data using this code:
arquivo = open('DATA.txt', 'r')
for linha in arquivo:
print(linha)
arquivo.close()
How can I apply the slice
in this context? Because I can do this in one sentence, but I don’t know how to apply it in several lines
print(line[1:17] + ';' + line[18:29] + ';' + line[30:38] + ';' + line[39:40] + ';' + line[41:42] + ';' + line[43:46] + ';' + line[47:48] + ';' + line[49:50] )
– Reginaldo Rigo