import xlrd
import sys,time data = xlrd.open_workbook("C:\Users\Administrator\Desktop\\new1.xlsx") table = data.sheets()[0] cols = table.ncols
rows = table.nrows for i in range(cols):
fields = table.col_values(i)
[appname,packet] = fields[:2]
# print appname,packet
for word in fields[2:]:
sys.stdout.flush()
# print "1:"+repr(word),
if len(word.strip())>0:
#print packet+"|"+word#有时候丟数据
print packet,"|",word#正常
time.sleep(0.01)
sys.stdout.flush()