python - Why is my result blank -
i'm new python, i'm using xlrd read excel. i'm attempting check value of first cell of each row against variable mid using following code
import xlrd file_location="z:/dashboard/test.xls" workbook = xlrd.open_workbook(file_location) sheet = workbook.sheet_by_index(0) mid=5348120284087186 row_count in range(sheet.nrows): if (sheet.cell_value(row_count, 0)==mid): print sheet.row_values(row_count) when comment out if statement runs fine without checking, displaying rows. if statement no results back. 5348120284087186 value in first cell on multiple lines , value of mid. there additional formatting need use xlrd in order find value? i've attempted not use variable , use 5348120284087186 comparison statement same results.
you wrote: attempted fix int() row_count in range(sheet.nrows):
if (int(sheet.cell_value(row_count, 0))==mid): print sheet.row_values(row_count) which resulted in error stating:
valueerror: invalid literal int() base 10: 'run date: ' that means value in cell isn't integer thought, 'run date: '.
Comments
Post a Comment