error :list out of range

Beema shafreen beema.shafreen at gmail.com
Tue Nov 13 04:23:02 EST 2007


hi everybody,
              I have written a code to check which is the lowest value in a
list ....
my list:
  ['94', 'A_16_P03647505', '-59', '42', 'A_16_P41573860', '-44', '513',
'A_16_P41573861', '-44', '66', 'A_16_P41573862', '-44', '327',
'A_16_P03647506', '-46', '77', 'A_16_P41573864', '-59', '52',
'A_16_P03647507', '-59', '307', 'A_16_P41573865', '-59', '111',
'A_16_P03647508', '-59', '167', 'A_16_P41573867', '-48', '223',
'A_16_P03647509', '-45', '124', 'A_16_P41573869', '-54', '206',
'A_16_P03647510', '-59', '52', 'A_16_P41573870', '-52', '549',
'A_16_P03647511', '-59', '2976']
mycode:
res_value = []
fh = open('test','r')
for line in fh.readlines():
        data = line.strip().split('\t')
        current_span = data[3].strip()
        probe = data[2].strip()
        length = data[4].strip()
        res_value.append(current_span)
        res_value.append(probe)
        res_value.append(length)
        #omplete_dataset.append(res_value)
fh.close()
for k in range(0,len(res_value),3):
        check = res_value[k:k+4]
        if check[0] < check[4]:
                print check
error: File "app.py", line 16, in <module>
    if check[0] < check[4]:
IndexError: list index out of range
i get an error like this how do i sort the error out to get result
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071113/7ac3081a/attachment.html>


More information about the Python-list mailing list