代码拉取完成,页面将自动刷新
同步操作将从 mktime/python-learn 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import xlrd, os, sys
from xlutils.copy import copy
def parse_excel(filename):
merge_book = xlrd.open_workbook(filename)
write_book = copy(merge_book)
files = [ x for x in os.listdir('.') if x.find("xlsname") > 1 ]
global_row_1 = 1
global_row_2 = 1
for i in range(len(files)):
date = files[i].split(".")[0][-8:]
#print date
read_book = xlrd.open_workbook(files[i])
read_sheets = read_book.sheets()
read_sheet_1 = read_sheets[0]
read_sheet_2 = read_sheets[1]
#print f
write_sheet_1 = write_book.get_sheet(0)
write_sheet_2 = write_book.get_sheet(1)
for row in range(read_sheet_1.nrows):
if i != 0 and row == 0:continue # skip table first line
for col in range(8):
value = read_sheet_1.cell_value(row, col)
write_sheet_1.write(global_row_1, col, value)
global_row_1 += 1
for row in range(read_sheet_2.nrows):
if i != 0 and row == 0:continue # skip table first line
for col in range(8):
value = read_sheet_2.cell_value(row, col)
write_sheet_2.write(global_row_2, col, value)
global_row_2 += 1
write_book.save("temp.xls")
if __name__ == '__main__':
if len(sys.argv) != 2:
print "usage: python %s <ms-xls-file>" % sys.argv[0]
sys.exit(-1)
filename = sys.argv[1].strip()
parse_excel(filename)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。