本文整理匯總了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]
)