coding utf-8 import xlrd import sys book xlrd open_workbook sys argv s

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# -*- coding: utf-8 -*-
import xlrd
import sys
b = []
book = xlrd.open_workbook(sys.argv[1])
sh = book.sheet_by_index(0)
for i in range(sh.nrows):
if i>0:
a = [sh.cell_value(rowx=i, colx=0).encode('utf-8'),sh.cell_value(rowx=i, colx=1),sh.cell_value(rowx=i, colx=2),sh.cell_value(rowx=i, colx=3),]
b.append(a)
print b