[Tutor] Help required

Arijit Ukil arijit.ukil at tcs.com
Wed Mar 20 07:14:06 CET 2013


I am new to python. My intention is to read the file digi.txt and store in 
separate arrays all the values of each columns. However, the following 
program prints only the last value, i.e. 1350696500.0.
Please help to rectify this.

f = open ("digi.txt", "r+")

datafile = f.readlines()

list_of_lists = datafile
for data in list_of_lists:
    lstval = data.split (',')
    timest = float(lstval[0])
    energy = float(lstval[1])

f.close()
print timest

Regards,
Arijit Ukil
Tata Consultancy Services
Mailto: arijit.ukil at tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130320/dd85169f/attachment.html>


More information about the Tutor mailing list