本文整理匯總了Python中future.builtins.dict.__setitem__方法的典型用法代碼示例。如果您正苦於以下問題:Python dict.__setitem__方法的具體用法?Python dict.__setitem__怎麽用?Python dict.__setitem__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類future.builtins.dict
的用法示例。
在下文中一共展示了dict.__setitem__方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from future.builtins import dict [as 別名]
# 或者: from future.builtins.dict import __setitem__ [as 別名]
def __init__(self):
# Set defaults
self.key = self.value = self.coded_value = None
# Set default attributes
for key in self._reserved:
dict.__setitem__(self, key, "")
示例2: __setitem__
# 需要導入模塊: from future.builtins import dict [as 別名]
# 或者: from future.builtins.dict import __setitem__ [as 別名]
def __setitem__(self, K, V):
K = K.lower()
if not K in self._reserved:
raise CookieError("Invalid Attribute %s" % K)
dict.__setitem__(self, K, V)
示例3: __set
# 需要導入模塊: from future.builtins import dict [as 別名]
# 或者: from future.builtins.dict import __setitem__ [as 別名]
def __set(self, key, real_value, coded_value):
"""Private method for setting a cookie's value"""
M = self.get(key, Morsel())
M.set(key, real_value, coded_value)
dict.__setitem__(self, key, M)
示例4: load
# 需要導入模塊: from future.builtins import dict [as 別名]
# 或者: from future.builtins.dict import __setitem__ [as 別名]
def load(self, rawdata):
"""Load cookies from a string (presumably HTTP_COOKIE) or
from a dictionary. Loading cookies from a dictionary 'd'
is equivalent to calling:
map(Cookie.__setitem__, d.keys(), d.values())
"""
if isinstance(rawdata, str):
self.__parse_string(rawdata)
else:
# self.update() wouldn't call our custom __setitem__
for key, value in rawdata.items():
self[key] = value
return