简体   繁体   中英

Two dimensional array in python

我需要将excel工作表中的值读取到2d数组中。有人可以告诉我如何使用pythonwin32com做到这一点。

You can have multi dimensional arrays or objects, your choice :)

arr = []; arr.append([1,2]); print arr;

would output

[[1,2]]

You can access to Excel cells like this:

from win32com.client import Dispatch

excel = Dispatch('Excel.Application')
wb = excel.Workbooks.Open("Full_path_to_your_excel_file")
sheet = wb.ActiveSheet

print sheet.Range('A1:C1')

But it is unclear for me what you want to put into 2d array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM