aditya shukla wrote:
I have a text file whose contents are like this:-
jd|fj|dnv|jd|0.33|c:\\windows\\win32
shcbsbs|nscsjsj|0.93|hsbcjsnc
I am trying to read the file like this:-
>>> x = open("c:\\a.txt","r")
>>> x.read()
eh, wouldn't it be easier if you actually read the replies to your last
post on this topic? here's an excerpt from the reply you got last time:
> Extracting is easy; you can do something like
>
> data = []
> for line in open("test.txt"):
> line = line.split("|")
> data.append(float(line[1]))
which fetches floating point values from the text file example you
posted last time:
> 0\9\10\11|0.50|c:\windows\apppatch/AcLayers.dll
> 0\9\10\11|0.50|c:\windows\apppatch/AcRedir.dll
> 0\9\10|0.66|c:\windows\apppatch/AcSpecfc.dll
> 0\9|0.83|c:\windows\apppatch/iebrshim.dll
if the values have moved to some other column, adjust line[1] accordingly.
</F>
--
http://mail.python.org/mailman/listinfo/python-list