简体   繁体   中英

Reading xls file with Python

import xlrd
cord = xlrd.open_workbook('MT_coordenadas_todas.xls')

id = cord.sheet_by_index(0)
print id

When I run my code in terminal,I got

<xlrd.sheet.Sheet object at 0x7f897e3ecf90>

I wanted to take the first column,so what should I change in my code?

id is a reference to the sheet object. You need to use values = id.col_values(0) to read the values from the first column of that sheet.

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