我是靠谱客的博主 受伤橘子,这篇文章主要介绍python单循环读取表数据excelpython读取excel,现在分享给大家,希望可以做个参考。

参考:https://www.jianshu.com/p/19219542bf23

python读取excel

单循环读取表数据

import xlrd
class DoExcel():

    def do_excel(self):
        data = xlrd.open_workbook(r'E:mycodetest_pythonexcel01.xlsx')
        sheet1 = data.sheet_by_name('Sheet1')
        list = []
        for i in range(0, sheet1.nrows):
            sub_data = {}
            sub_data['一'] = sheet1.cell(i, 0).value # i行第一列
            sub_data['二'] = sheet1.cell(i, 1).value # i行第二列
            list.append(sub_data)

        return list

if __name__ == '__main__':
    DoExcel().do_excel()

最后

以上就是受伤橘子最近收集整理的关于python单循环读取表数据excelpython读取excel的全部内容,更多相关python单循环读取表数据excelpython读取excel内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部