2011/6/2 Jose Caballero <[email protected]>
>
>>
>> fc = open('archivo.txt','r')
>>
>> for linea in fc:
>> b = linea.rfind('|')
>> posi = b + 1
>> posf = posi + 9
>> secuenciac = linea[posi:posf]
>> print secuenciac
>>
>>
>>
>
>
> Has probado
>
> fc = open(.....)
> for linea in fc:
> secuenciac = linea.split('|')[-1]
>
>
Yo abro todos los días ficheros de ese pelo y no me tarda tanto. Prueba lo
siguiente y dime a ver si te funciona:
ficheroentrada = open('archivo.txt','r')
ficherosalida = open('salida.txt','w')
for linea in ficheroentrada:
ficherosalida.write("" + linea.split('|')[-1] + ";\n")
ficheroentrada.close()
ficherosalida.close()
_______________________________________________
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/