號xlrd.Cell
對象的定義是:
# Type: Cell
# String Form:number:42.0
# File: c:\python27\lib\site-packages\xlrd\sheet.py
# Source:
class Cell(BaseObject):
__slots__ = ['ctype', 'value', 'xf_index']
def __init__(self, ctype, value, xf_index=None):
self.ctype = ctype
self.value = value
self.xf_index = xf_index
def __repr__(self):
if self.xf_index is None:
return "%s:%r" % (ctype_text[self.ctype], self.value)
else:
return "%s:%r (XF:%r)" % (ctype_text[self.ctype], self.value, self.xf_index)
所以有在Cell
對象到父Worksheet
沒有引用。您可以輕鬆地擴展xlrd.Worksheet
和xlrd.Cell
類以添加此類引用,但您可以將父級工作表以及函數傳遞給您的函數,並省去麻煩。