[Python-de] Re: ASCII file lesen
Tobias Herp
Nummer-5 at gmx.net
Son Feb 1 23:39:28 CET 2004
gerhard quell schrieb:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hallo Daniela,
>
> ~ was hältst Du von folgender Lösung:
>
> import string
> input=open('file','r')
> S=input.readlines()
> for i in S:
> ~ ss=string.splitfields(i[:-1],",")
> ~ for j in ss:
> ~ print string.atof(j)
Sind atof und das string-Modul nicht deprecated?
input=open('file','r')
S=input.readlines()
res = []
for i in S:
res.append([ int(a) for a in i.split(',') ])
(nicht getestet)
Tobias