0

我在 pylibnet 库中自我介绍,我想问你如何获取在这段代码中导入的常量。

import libnet
from libnet.constants import *

我尝试 help(libnet) 但我的问题没有任何答案。

谢谢!!

4

1 回答 1

1

你试过dir(libnet.constants)吗?

libnet.constants.__dict__应该工作。

为了减少噪音,你可以做

[x for x in libnet.constants.__dict__ if x[:2] != '__' and not callable(libnet.constants.__dict__[x])]
于 2011-03-17T18:16:35.913 回答