我有一门课:
class Holiday(ActivitiesBaseClass):
"""Holiday is an activity that involves taking time off work"""
Hotel = models.CharField(max_length=255)
""" Name of hotel """我可以通过键入以下命令来打印类docstring:
print(Holiday.__doc__)输出结果为:
Holiday is an activity that involves taking time off work 如何打印酒店的docstring,它是一个Class属性/元素?
我尝试过的
print(Holiday.Hotel.__doc__)返回:
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.我还尝试了help()函数,但没有用。
N.B
Sphinx似乎能够提取class属性的文档字符串,并将它们包含在readthedocs中,所以我希望有一种方法
https://stackoverflow.com/questions/59880963
复制相似问题