Created
December 7, 2016 03:56
-
-
Save jackyshan/ae58b09dde41bca6126d90dac64f337e to your computer and use it in GitHub Desktop.
处理excel导出db数据
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import xlrd | |
| data = xlrd.open_workbook('xx.xls') | |
| fo = open("xx.txt", "w") | |
| for i in range(len(data.sheets())): | |
| table = data.sheets()[i] | |
| nrows = table.nrows | |
| for row in range(nrows): | |
| content = table.row_values(row) | |
| fo.writelines(str(content) + '\n') | |
| fo.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment