|
imn1Apr 2, 2021
1
一切皆为对象
import re dir(re) |
|
2
@imn1 这样把引入的变量什么的都包含了
|
|
estApr 2, 2021
3
ast 模块
|
|
demobinApr 2, 2021
4
for item in re.__all__:
print(item, hasattr(getattr(re, item), '__call__')) |
|
imn1Apr 2, 2021
5
@alittlecode #2
你自己多想一步不行么?有个内置函数叫 callable() 如果你想更“正式”一点,以前有个包叫 optparse,不过已经废弃了 现在可以用 inspect,typing 之类的自己组织 |
|
chionetw5Apr 2, 2021
6
通过 importlib
|
|
xiaolinjiaApr 2, 2021
7
inspect.getmembers(promotions, inspect.isfunction)
|
|
dingwen07Apr 2, 2021 via iPhone
8
inspect 模块
|