I have the following image: Please look at it for reference.
http://i58.tinypic.com/33219hh.png
What I am trying to get is for the code to read every value in each column, and tell me how many times that "number" and "letter" is there in the column. In other words, what is the occurrence of that "number" and "letter" in their respective columns?
Here is my code:
import xlrd,xlwt
ws = 'C://Users/Jack/Desktop
extract=[]
wb1 = xlrd.open_workbook(ws + 'try.xlsx')
sh1 = wb1.sheet_by_index(0)
for a in range(0,sh1.nrows):
for b in range(0,sh1.ncols):
extract.append(sh1.cell(a,b).value)
#print(extract)
print()
print('4:',extract.count('4'))
Output is 4: 0
I am only trying to count the number 4 from the first column
because I do not know how to count everything from every
column at once. The output is supposed to read 4: 3
.
But, I want to know how to read everything at once as mentioned
earlier above.