可以使用xlrd库来读取xls文件。以下是一个示例代码,用于将xls文件的第一列数据存入字符串数组:

import xlrd

# 打开xls文件
workbook = xlrd.open_workbook('data.xls')

# 选择第一个Sheet
sheet = workbook.sheet_by_index(0)

# 获取第一列数据
column_values = sheet.col_values(0)

# 将数据存入字符串数组
string_array = [str(value) for value in column_values]

print(string_array)

请确保在运行代码之前已经安装了xlrd库。

使用python读取xls文件第一列存入字符串数组

原文地址: https://www.cveoy.top/t/topic/iLMG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录