本文整理汇总了Python中collections.OrderedDict.__repr__方法的典型用法代码示例。如果您正苦于以下问题:Python OrderedDict.__repr__方法的具体用法?Python OrderedDict.__repr__怎么用?Python OrderedDict.__repr__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collections.OrderedDict
的用法示例。
在下文中一共展示了OrderedDict.__repr__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pprint_for_ordereddict
# 需要导入模块: from collections import OrderedDict [as 别名]
# 或者: from collections.OrderedDict import __repr__ [as 别名]
def pprint_for_ordereddict():
"""
Context manager that causes pprint() to print OrderedDict objects as nicely
as standard Python dictionary objects.
"""
od_saved = OrderedDict.__repr__
try:
OrderedDict.__repr__ = dict.__repr__
yield
finally:
OrderedDict.__repr__ = od_saved
示例2: __repr__
# 需要导入模块: from collections import OrderedDict [as 别名]
# 或者: from collections.OrderedDict import __repr__ [as 别名]
def __repr__(self):
return 'OrderedDefaultDict(%s, %s)' % (self.default_factory,
OrderedDict.__repr__(self))
开发者ID:ComparativeGenomicsToolkit,项目名称:Comparative-Annotation-Toolkit,代码行数:5,代码来源:defaultOrderedDict.py
示例3: __repr__
# 需要导入模块: from collections import OrderedDict [as 别名]
# 或者: from collections.OrderedDict import __repr__ [as 别名]
def __repr__(self):
return 'DefaultOrderedDict(%s, %s)' % (self.default_factory,
OrderedDict.__repr__(self))
示例4: __repr__
# 需要导入模块: from collections import OrderedDict [as 别名]
# 或者: from collections.OrderedDict import __repr__ [as 别名]
def __repr__(self):
return "OrderedDefaultDict({}, {})".format(
self.default_factory, OrderedDict.__repr__(self),
)
示例5: __repr__
# 需要导入模块: from collections import OrderedDict [as 别名]
# 或者: from collections.OrderedDict import __repr__ [as 别名]
def __repr__(self, _repr_running=None):
if _repr_running is None:
_repr_running = {}
return 'OrderedDefaultDict(%s, %s)' % (self.default_factory,
OrderedDict.__repr__(self, _repr_running))
示例6: __repr__
# 需要导入模块: from collections import OrderedDict [as 别名]
# 或者: from collections.OrderedDict import __repr__ [as 别名]
def __repr__(self):
return "DefaultOrderedDict({}, {})".format(
self.default_factory, OrderedDict.__repr__(self)[19:-1]
)