#coding=utf-8 import xlrd import os import operator fxls = 'mobile.xlsx' bp = xlrd.open_workbook(fxls) shxrange = range(bp.nsheets) try: sh = bp.sheet_by_name('Sheet1') except: print('error') #get lines nrows = sh.nrows #get cols ncols = sh.ncols print("nrows %d,ncols %d" %(nrows, ncols)) #get pos(1,1) data cell_value = sh.cell_value(0,0) #print(cell_value) dict= {} for i in xrange(1,15): a = sh.cell_value(i,16) b = sh.cell_value(i,17) dict[a] = b sorted_x = sorted(dict.items(), key=lambda dict : dict[0]) for (k,v) in sorted_x: print(v)