<div dir="ltr">Guys thanks for your previous help .I have a doubt again<br><br>My text file is :-<br><br>0\9\10\11|0.50|c:\windows\apppatch/AcLayers.dll<br>0\9\10\11|0.50|c:\windows\apppatch/AcRedir.dll<br>0\9\10|0.66|c:\windows\apppatch/AcSpecfc.dll<br>
0\9|0.83|c:\windows\apppatch/iebrshim.dll<br>0|0.92|c:\windows\apppatch/pcamain.sdb<br>0|0.92|c:\windows\apppatch/sysmain.sdb<br>0|0.93|c:\windows\apppatch/AcXtrnal.dll<br>0|0.97|c:\windows\apppatch/msimain.sdb<br>0|0.98|c:\windows\apppatch/AcRes.dll<br>
0|0.98|c:\windows\apppatch/drvmain.sdb<br>0|0.98|c:\windows\apppatch/en-US/AcRes.dll.mui<br>0|0.99|c:\windows\apppatch/apihex86.dll<br>0|1.00|c:\windows\apppatch/AcGenral.dll<br><br><br>now this is what happens<br><br>>>> x=open("c:\\test2.txt","rb")<br>
>>> x.readline()<br><br>'\n' ---? i am not able to understand why  is  new line character returned here<br><br>>>> l =x.readline()<br>>>> print l<br><br><br>Also , because of this i am not able to extract the floating point values ie 0.50,0.50,0.66 respectively<br>
cause when i use the proposed solution given earlier <br><br>data=[]<br>for line in x:<br>   line=line.split("|") <br>   data.append(float(line[-2])) --> i am trying to get the floating point values from the back<br>
   <br>i receive this error message<br><br>Traceback (most recent call last):<br>  File "<pyshell#71>", line 3, in <module><br>    d.append(float(line[-2]))<br>IndexError: list index out of range<br>
<br>Whereas the solution works well with the dummy  text file which i have created  which is a.txt<br><br>jd|fj|dnv|jd|0.33|c:\\windows\\win32<br>shcbsbs|nscsjsj|0.93|hsbcjsnc<br><br>x=open("a.txt","r")<br>
data=[]<br>
for line in x:<br>
   line=line.split("|") <br>
   data.append(float(line[-2]))<br><br><br>print data<br><br>0.3300002,0.9300006<br><br>Please help me fix this problem<br><br>Thanks in advance<br><br>Aditya<br></div>