I have several txt files with information on some payments in txt separated by line breaks and slashes. What I have is this:
{
#!/usr/bin/env python
# Importacion de la libreria necesaria
import re
#Apertura de archivo
fname = raw_input(": >")
fopen = open(fname)
#Se definen 3 listas, una para cada columna
col1 = list()
col2 = list()
col3 = list()
#Edicion del texto para cada campo
for i in fopen:
col = re.findall('[0-9]+', i)
col1.append(col[0].lstrip('0'))
col2.append(col[1].lstrip('0'))
decimal = col[2] + "." + col[3]
col3.append(decimal)
fopen.close()
#Impresion de archivo PRN
cont = 0
while cont < len(col1):
prn = col1[cont] + " " + col2[cont] + " " + col3[cont] + "\n"
print prn
cont = cont + 1
fwrite.write(prn)
}
The text is as I want, what I want to do is save a PRN file (text with spaces with a maximum length of 240 characters per line) directly with python with the aforementioned format.
{
3830762 403 2620.39
3830762 404 2620.39
3830762 216 3226.30
3975560 217 1329.61
3975560 210 2124.30
3975560 403 3351.33
3975560 404 3351.33
4068493 403 2922.72
4068493 404 2922.72
4378091 210 1028.15
4378091 403 2337.48
4378091 404 2337.48
4404173 216 1001.80
4527545 403 2227.71
4527545 404 2227.71
4975179 216 824.10
4975179 403 2254.68
4975179 404 2254.68
5048485 403 2643.13
5048485 404 2643.13
5060558 403 3516.09
5060558 404 3516.09
5181225 403 3498.39
5181225 404 3498.39
}