[Python-es] Lectura y formateo de ASCII
Pau Cervera
pau.cervera en gmail.com
Mar Sep 21 13:08:24 CEST 2010
El código en cursiva no se interpreta bien. :)
-----
Pau
Python..., what else?
On Tue, Sep 21, 2010 at 10:57 AM, Juan Camilo Hernandez D <
camilo.hernandez en gmail.com> wrote:
> He solucionado el problema de la siguiente forma:
>
>
> 1. *from numpy import **
> 2. *data = [[] for dummy in xrange(13)]*
> 3. *archivo = open('../data/TI_1_0004.txt', 'r')*
> 4. *archivo.readline()*
> 5. *
> *
> 6. *for line in archivo:*
> 7. * fields = line.strip().split('\t')*
> 8. * for i, number in enumerate(fields):*
> 9. * data[i].append(number)*
> 10. *rec.array(data,float) *
> 11. *
> *
> 12. *m=int(shape(data)[1])*
> 13. *n=m/33*
> 14. *for x in range(m):*
> 15. * a = data[1][x] *
> 16. * tmp[1][x] = a*
> 17. *LONGIT = []*
> 18. *LONGIT= tmp[1][:]*
> 19. *array(LONGIT)*
> 20. *LONGIT.shape = ((m/33),33)*
>
> Cualquier sugerencia sobre esta solucion sera bienvenida.
>
> --
> Juan Camilo Hernández Díaz
> Ingeniero Sanitario
>
> _______________________________________________
> Python-es mailing list
> Python-es en python.org
> http://mail.python.org/mailman/listinfo/python-es
> FAQ: http://python-es-faq.wikidot.com/
>
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20100921/eae17c7b/attachment.html>
Más información sobre la lista de distribución Python-es