line break in file.txt

0
        if (cont == 0):#si no tiene errores manda SINTAXIS OK
            cadena = 'linea'+" "+str(i)+" "+str(oracion)+" "+"SINTANXIS OK"+"\n"
        else:#sino manda todos los errores que tiene
            cadena = 'linea'+' '+str(i)+" "+str(oracion)+" "+str(cont)+" "+"ERROR(ES)"+"\n"
        archi.write(cadena)

in line 0 I would like it to be shown as in line 1, but line 0 does line jump

    
asked by Efrainrodc 09.05.2017 в 04:08
source

1 answer

3

First of all there is something wrong in the examples, this

cadena = 'linea'+" "+str(i)+" "+str(oracion)+" "+"SINTANXIS OK"+"\n"

You can not generate this output:

Linea 0 MARIA JUEGA.sdf
1 ERROR(ES)

And if you see a line break it occurs to me that you could have oracion , so you could do str(oracion).strip()

    
answered by 09.05.2017 / 04:34
source