python将字符串转换为xls文档进行处理
python convert a string to an xls document for processing
new_list = eval(my_list[0]) # my_list contains dictionaries
def get_next_file():
for key, value in new_list.iteritems():
yield value
file = get_next_file
book = xlrd.open_workbook(file_contents=file)
for sheet in book.sheet_names():
print sheet
我正在尝试从 dict 中获取一个字符串并将其转换为 xls 文件以便对其进行处理。这是一个 xls 文件,我使用 str(list(xls_file)) 以便它可以保存在我的数据库中。
有什么想法吗?
保存的字符串打印为十六进制,其中包含一些单词。
您正在使用的库 xlrd 仅用于从 excel 文件中读取信息。
如果你想写一个新的 excel 文件你需要使用 xlwt.
如果您想更改 excel 文件中的某些单元格,您应该使用 xlutils.
这三个图书馆的主页:http://www.python-excel.org/
new_list = eval(my_list[0]) # my_list contains dictionaries
def get_next_file():
for key, value in new_list.iteritems():
yield value
file = get_next_file
book = xlrd.open_workbook(file_contents=file)
for sheet in book.sheet_names():
print sheet
我正在尝试从 dict 中获取一个字符串并将其转换为 xls 文件以便对其进行处理。这是一个 xls 文件,我使用 str(list(xls_file)) 以便它可以保存在我的数据库中。
有什么想法吗?
保存的字符串打印为十六进制,其中包含一些单词。
您正在使用的库 xlrd 仅用于从 excel 文件中读取信息。
如果你想写一个新的 excel 文件你需要使用 xlwt.
如果您想更改 excel 文件中的某些单元格,您应该使用 xlutils.
这三个图书馆的主页:http://www.python-excel.org/