On 11/14/2012 1:35 AM, Amit Agrawal wrote:
my problem is, i want to access data in spreadsheet to python code manualy
My data is

1/1982 8:00:000
1/2/1982 8:00:000
1/3/1982 8:00:000
1/4/1982 8:00:000
1/5/1982 8:00:000.7885
1/6/1982 8:00:000
1/7/1982 8:00:000
1/8/1982 8:00:001.6127

You used tabs, which get deleted by some mail/news readers. Anyway, here is a start:

data='''\
1/1982 8:00:00 0
1/5/1982 8:00:00 0.7885
1/19/1982 8:00:00 0
1/20/1982 8:00:00 0'''

lines = data.split('\n')
# up to here, only for example

for line in lines:
    fields = line.split()
print('date {}: time {}: value {}'.format(fields[0], fields[1], fields[2]))

>>>
date 1/1982: time 8:00:00: value 0
date 1/5/1982: time 8:00:00: value 0.7885
date 1/19/1982: time 8:00:00: value 0
date 1/20/1982: time 8:00:00: value 0

For real usage assume data are in data.txt in current directory. Then start with

with open('data.txt') as lines:
  for line in lines....

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to