related to list and file handling?

Posted by kaushik on Stack Overflow See other posts from Stack Overflow or by kaushik
Published on 2010-05-27T09:21:16Z Indexed on 2010/05/27 9:31 UTC
Read the original article Hit count: 179

Filed under:

i have file with contents in list form such as

[1,'ab','fgf','ssd']
[2,'eb','ghf','hhsd']
[3,'ag','rtf','ssfdd']

i want to read that file line by line using f.readline and assign thn to a list so as to use it is the prog as a list for using list properties

tried like

k=[ ]
k=f.readline()
print k[1] 

i xpected a result to show 2nd element in the list in first line but it showed the first bit and gave o/p as '1'

how to get the xpected output..

please suggest

© Stack Overflow or respective owner

Related posts about python