slot wrapper 和 attribute 怎么解释

来源:10-11 re.sub正则替换

慕粉1757246390

2019-11-30

你好,老师,
print(re.Match.dict)的打印如下:
{‘repr’: <slot wrapper ‘repr’ of ‘re.Match’ objects>, ‘getitem’: <slot wrapper ‘getitem’ of ‘re.Match’ objects>, ‘group’: <method ‘group’ of ‘re.Match’ objects>, ‘start’: <method ‘start’ of ‘re.Match’ objects>, ‘end’: <method ‘end’ of ‘re.Match’ objects>, ‘span’: <method ‘span’ of ‘re.Match’ objects>, ‘groups’: <method ‘groups’ of ‘re.Match’ objects>, ‘groupdict’: <method ‘groupdict’ of ‘re.Match’ objects>, ‘expand’: <method ‘expand’ of ‘re.Match’ objects>, ‘copy’: <method ‘copy’ of ‘re.Match’ objects>, ‘deepcopy’: <method ‘deepcopy’ of ‘re.Match’ objects>, ‘string’: <member ‘string’ of ‘re.Match’ objects>, ‘re’: <member ‘re’ of ‘re.Match’ objects>, ‘pos’: <member ‘pos’ of
’re.Match’ objects>, ‘endpos’: <member ‘endpos’ of ‘re.Match’ objects>, ‘lastindex’: <attribute ‘lastindex’ of ‘re.Match’ objects>, ‘lastgroup’: <attribute ‘lastgroup’ of ‘re.Match’ objects>, ‘regs’: <attribute ‘regs’ of ‘re.Match’ objects>, ‘doc’: ‘The result of re.match() and re.search().\nMatch objects always have a boolean value of True.’}

老师已经讲过类的member和method,但没讲过slot wrapper和attribute,不知这两个如何解释,如何定义?

谢谢!

写回答

1回答

7七月

2019-12-01

slot这个基本用不到,但确实是python里的语法。可以搜索下slot,这比我在这打字要好很多。attribute不知道啥意思?

0
0

Python3.8系统入门+进阶 (程序员必备第二语言)

语法精讲/配套练习+思考题/原生爬虫实战

14817 学习 · 4493 问题

查看课程