腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
2
回答
如何
打印
class
属性
/
元素
的
docstring
?
python
、
django
、
python-3.x
、
django-models
、
docstring
work""" """ Name of hotel """ 我可以通过键入以下命令来
打印
类
docstring
__doc__) 输出结果为: Holiday is an activity that involves taking time off work
如何
打印
酒店
的
docstring
,它是一个<
浏览 17
提问于2020-01-23
得票数 5
回答已采纳
1
回答
Class
docstring
块中
的
class
属性
docstring
python
、
python-sphinx
、
docstring
我正在使用Sphinx记录我
的
Python项目,并希望在
class
docstring
块中记录
class
属性
。
属性
内联文档字符串很难看。我确实尝试将
docstring
属性
添加到类
docstring
块中,但当Sphinx生成html时,它不能正确显示。
class
MyClass(): MyClass
docstring
block.:att
浏览 3
提问于2019-01-03
得票数 1
1
回答
Python
属性
docstring
只在整个类上
打印
帮助。
python
、
python-2.7
、
properties
、
docstring
我试图在python模块中记录一个@property,但是无法在
属性
的
帮助中显示
docstring
。我想打个电话给help(
class
.property),只
打印
那个
属性
的
帮助。下面是一个例子: def __init__(self):当我导入并尝试获取帮助时,它可以在整个类上工作,但不能在单独
的
浏览 0
提问于2019-03-06
得票数 1
回答已采纳
1
回答
Python模块文档字符串
python
、
module
、
docstring
如何
从我
的
主文件
打印
我
的
python模块文件
的
docstring
?假设我有一个名为Projectile.py
的
python模块文件,它在其中定义了一个名为Projectile
的
类。然后我有另一个名为main.py
的
python文件。在main中,我想访问模块级文档字符串。我该怎么做呢? 我知道
如何
打印
类和方法
的
文档字符串。例如,要
打印
我
的
主文件中
浏览 0
提问于2020-04-10
得票数 1
1
回答
如何
检索Python类实例
的
属性
的
docstring
?
python
、
properties
、
docstring
假设我有一个这样
的
类: """
Class
docstring
""" """Method__doc__)# Method
docstring
但是,这种方法并不适用于
属性</em
浏览 2
提问于2016-06-30
得票数 9
回答已采纳
1
回答
Python,
如何
在报表中显示TestCase方法
的
docstring
?
python
、
python-unittest
有没有办法 def test_bar(self): a
docstring
要使UnitTest报告显示整个
docstring
我读过文档字符串
的
第一行将被
打印
出来(所以写)无断行工程)但是,它是关于删除
docstri
浏览 2
提问于2015-07-12
得票数 1
回答已采纳
3
回答
使用类
属性
修改带有Python装饰符
的
docstring
python
、
decorator
、
docstring
我正在尝试创建一个在类中调用
的
装饰符,它将从该类中提取
属性
,并使用这些类
属性
来编辑函数
的
docstring
。我
的
问题是,我找到了编辑函数
的
docstring
(将函数
的
__doc__
属性
设置为新字符串)
的
装饰器
的
示例,还找到了从父类中提取
属性
的
装饰器示例(通过将self传递给装饰器),但我还没有找到能够同时执行这两种操作
的
装饰器
浏览 1
提问于2018-09-18
得票数 1
回答已采纳
2
回答
Python3.6.1:
如何
动态
打印
docstring
?
python
、
python-3.x
、
dynamic
、
printing
、
docstring
在阅读一些Python培训书籍时,我对对象做了一些修改,比如
打印
用于常见对象和
属性
的
文档字符串。考虑以下字符串返回
的
列表:我试图迭代上面的内容,以便用下面的循环动态地
打印
存储在dir列表中
的
属性
的
docstring
: print__doc__) 这将返回str对象
的
dir输出,而不是它
的
属性
,这不是我要找<em
浏览 3
提问于2017-10-05
得票数 1
回答已采纳
2
回答
如何
将测试名称和模块添加到测试文档字符串中?
python
、
django
、
python-2.7
、
unit-testing
、
nose
我正在使用django_nose
的
NoseTestSuiteRunner来运行测试。目前,如果测试有
docstring
,它将被
打印
在测试控制台(TestCase.ShortDescrption())上,如果它是测试
的
None名称(TestCase.id()),那么我想将TestCase.id()添加到TestCase.ShortDescription()中,这样不管
docstring
是否存在,TestCase.id()都会被
打印
出来。样本测试:
class
Foo(un
浏览 3
提问于2016-03-31
得票数 2
回答已采纳
4
回答
继承父类
docstring
作为__doc__
属性
python
、
docstring
、
django-rest-framework
这里有一个关于
的
问题,但这里
的
答案涉及到方法文档字符串。 我
的
问题是
如何
继承父类
的
文档字符串作为__doc__
属性
。用法是会根据视图类
的
文档字符串在API
的
html版本中生成良好
的
文档。但是当在没有
docstring
的
类中继承基类(带有
docstring
)时,API不会显示
docstring
。很可能是sphinx和其他工具做了正确
的
事情,并为我处
浏览 0
提问于2012-12-19
得票数 14
回答已采纳
2
回答
C#根据
属性
值删除XML
元素
c#
、
xml
会非常感谢你在这件事上
的
帮助。如果一个
元素
包含Deleted = true
属性
,下面的代码将从XML中删除该
元素
。除了只删除第一个匹配项之外,它可以很好地工作。我希望它删除
属性
condition Deleted = true
的
所有对象
元素
public static string TestMethod1(string xmlpath)Value == "true").FirstOrDefault() .Remo
浏览 32
提问于2020-11-06
得票数 0
1
回答
为什么Sphinx不记录我
的
类?
python
、
python-sphinx
我有一个包含4个类
的
模块 """
Docstring
for B."""pass """
Docstring
for C.""" """
Docstring
for D.""&quo
浏览 3
提问于2017-07-24
得票数 0
回答已采纳
1
回答
在Python 3中设置动态类型
的
文档字符串
python
、
python-3.x
我正在动态创建一些类,我希望它们有不同
的
文档字符串。我有:
class
X: X.__doc__ =
class
_
docstring
这不起作用,因为文档字符串是只读
的
。然后,我试着: def make_
class
(
class
_name,
class
_
docs
浏览 2
提问于2011-11-16
得票数 4
回答已采纳
2
回答
实现保留
docstring
的
类
属性
。
python
、
properties
、
decorator
、
python-decorators
、
docstring
我有一个描述符,它将方法转换为类级别上
的
属性
: self.getter__doc__ return self.getter(owner)
class
A(object): def test(cls): "
浏览 0
提问于2014-03-12
得票数 4
回答已采纳
2
回答
如何
使用编辑魔术
打印
我定义
的
对象
的
源代码
ipython
Ipython 0.13.1可以
打印
python库中对象
的
源代码。但是我不能
打印
我在ipython中通过魔术定义
的
任何对象
的
源代码,%ed
class
Name(object): name = 'hong'
浏览 0
提问于2012-12-17
得票数 12
回答已采纳
1
回答
Python2.7:类
的
setter方法中忽略
的
doctest
python
、
python-2.7
、
properties
、
setter
、
doctest
class
Foo: def a(self): def a(self, vpass import doctest调试器确认没有运行测试(上面写入dtest.py
的
示例:>>> doctest.testmod(dtes
浏览 1
提问于2014-04-28
得票数 5
回答已采纳
1
回答
如何
使用Python数据类记录类
的
构造函数?
python
、
documentation
、
python-3.7
、
docstring
、
python-dataclasses
我有__init__方法和漂亮
的
文档字符串文档,指定构造函数
的
属性
和它们
的
类型。经过编辑以澄清我目前使用
的
是文档字符串
浏览 42
提问于2018-07-02
得票数 33
回答已采纳
1
回答
让Sphinx替换文档字符串文本
python
、
python-sphinx
、
substitution
、
docstring
我正在用Sphinx记录类似于下面这样
的
代码: pass
class
ParentClass(object): def __init__(self): pass
浏览 2
提问于2012-07-28
得票数 6
回答已采纳
2
回答
如何
在python中重写函数
的
原始签名
python
假设我有以下函数: ''' this is a
docstring
'''person(*args, **kwargs) this is a
docstring
但我想看到
的
是: person(name, age,
浏览 0
提问于2020-08-19
得票数 0
1
回答
numpydoc约定:方法修改类,但什么也不返回
python
、
numpy
、
docstring
、
numpydoc
有关numpydoc
docstring
约定
的
问题:
class
MyClass(object): self.a = a self.b = b,MyClass.a_mult不返回任何东西,而是向MyClass添加了一个
属性
。我按照MyClass.a_mult样式指南为提供了一个
docstring
。
doc
浏览 2
提问于2016-06-03
得票数 1
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
实时音视频
对象存储
云直播
活动推荐
运营活动
广告
关闭
领券