使用python读取excel

简介: 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34173549/article/details/81178561 使用python读取excel1.
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34173549/article/details/81178561

使用python读取excel

1.使用的库为lxrd,安装可用:pip install lxrd

# coding=utf-8
import xlrd

# 文件的名字
file_name = "not_get_app.xlsx"
# 打开文件
bk = xlrd.open_workbook(file_name)
# 代开sheet1
sh = bk.sheet_by_name("Sheet1")
# 获取行数
row_num = sh.nrows
row_list = []
for i in range(1, row_num):
    # 获取第i行的正行的数据
    row_data = sh.row_values(i)
    row_list.append(row_data)
# 打印每一行的内容,打印出的为列表的形式
for row in row_list:
    print row

注意:从excel里读取的整数转化出来为浮点型数据

相关文章
|
15天前
|
Python
python_读写excel、csv记录
python_读写excel、csv记录
16 0
|
11天前
|
存储 Python Windows
轻松学会openpyxl库,Python处理Excel有如神助
轻松学会openpyxl库,Python处理Excel有如神助
|
12天前
|
NoSQL Python
在Python中,我们可以使用许多库来处理Excel文件
Python处理Excel常用pandas和openpyxl库。pandas的`read_excel`用于读取文件,`to_excel`写入;示例展示了数据框操作。openpyxl则用于处理复杂情况,如多工作表,`load_workbook`加载文件,`iter_rows`读取数据,`Workbook`创建新文件,写入单元格数据后保存。
20 1
|
17天前
|
Python
Python异步编程|PySimpleGUI界面读取PDF转换Excel
Python异步编程|PySimpleGUI界面读取PDF转换Excel
20 1
|
22天前
|
小程序 数据挖掘 iOS开发
Python + Excel 办公自动化 01 —— 硬菜马上就来
Python + Excel 办公自动化 01 —— 硬菜马上就来
22 1
|
22天前
|
存储 Python
终于,手把手教会 HR 实现 Python + Excel 「邮件自动化」发工资条了
终于,手把手教会 HR 实现 Python + Excel 「邮件自动化」发工资条了
29 0
|
22天前
|
数据挖掘 索引 Python
Python 读写 Excel 文件
Python 读写 Excel 文件
99 0
|
28天前
|
Python
Python—提取页面上所有信息输出excel
Python—提取页面上所有信息输出excel
|
28天前
|
开发者 Python
如何让excel 运行python代码
如何让excel 运行python代码
|
1月前
|
Python
【python】提取多个excel的工作簿,生成新的excel
【python】提取多个excel的工作簿,生成新的excel