xlrd
import xlrd as xl# 读取文件
excel = xl.open_workbook("testdata/testdata.xls")
# 读取文件第一页
table = excel.sheets()
# 读取文件总行数
print(table.nrows)
# 读取文件总列数
print(table.ncols)
# 读取文件第一行数据
print(table.row_values(0))
# 读取文件第一列数据
print(table.col_values(0))
# 循环读取数据
print("--------------------------------------------------------")
for i in range(1,table.nrows):
print(table.row_values(i)) @overload
def __init__(
self: Connection,# different between overloads
*,
host: str | None = ...,
user: Any | None = ...,
password: str = ...,
database: Any | None = ...,
port: int = ...,
unix_socket: Any | None = ...,
charset: str = ...,
sql_mode: Any | None = ...,
read_default_file: Any | None = ...,
conv=...,
use_unicode: bool | None = ...,
client_flag: int = ...,
cursorclass: None = ...,# different between overloads
init_command: Any | None = ...,
connect_timeout: int | None = ...,
ssl: Mapping | None = ...,
ssl_ca=...,
ssl_cert=...,
ssl_disabled=...,
ssl_key=...,
ssl_verify_cert=...,
ssl_verify_identity=...,
read_default_group: Any | None = ...,
compress: Any | None = ...,
named_pipe: Any | None = ...,
autocommit: bool | None = ...,
db: Any | None = ...,
passwd: Any | None = ...,
local_infile: Any | None = ...,
max_allowed_packet: int = ...,
defer_connect: bool | None = ...,
auth_plugin_map: Mapping | None = ...,
read_timeout: float | None = ...,
write_timeout: float | None = ...,
bind_address: Any | None = ...,
binary_prefix: bool | None = ...,
program_name: Any | None = ...,
server_public_key: bytes | None = ...,
): ...
页:
[1]