python3.8/site-packages/pydicom/filewriter.py", line 338, in write_number_string
reidentify_1 | val = strreidentify_1 | File "/usr/local/lib/python3.8/site-packages/pydicom/valuerep.py", line 344, in __str__<e
我有一个自定义枚举类,它只能在调用__str__或__repr__时返回一组特定的字符串文本。考虑到这些序列化的字符串文本有时用作其他函数的输入(而且这些输入类型很好,即仅限于正确的字符串集),我希望返回类型的__str__和__repr__比str更精确。所以上面的注释应该可以工作,但是对于mypy,我得到:
playground.py:8: error: Incompatible types in assignment (expression has type "s
我有一个没有str或repr方法的类。当我叫它的时候: >>> from ingest.tpr import TPR>>> t # that is, "repr(t)"
<ingest.tpr.TPR instance上面的方法是__repr__方法还是__str__方法--我知道它调用上面的__repr__方法,但是__str__和__r
为什么在Python2.7中>>> raise ValueError("This is an example: %s" % repr(test_stringValueError: This is an example: 'this is a \\test'>>> raise KeyError("This is an example: %s" % repr