本文整理汇总了Python中Game.Game.parseJSON方法的典型用法代码示例。如果您正苦于以下问题:Python Game.parseJSON方法的具体用法?Python Game.parseJSON怎么用?Python Game.parseJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Game
的用法示例。
在下文中一共展示了Game.parseJSON方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseJSON
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import parseJSON [as 别名]
def parseJSON(self, dct):
"""
Initialize the object with the content of a JSON
Args:
dct (dict): A dictionary like object with the data
"""
if 'notification_id' in dct: self.notification_id = dct['notification_id']
if 'last_chat_activity' in dct: self.last_chat_activity = dct['last_chat_activity']
if 'tournaments' in dct: self.tournaments = dct['tournaments'] # We don't care about tournaments
if 'celebrity_tournaments' in dct: self.celebrity_tournaments = dct['celebrity_tournaments'] # Nor celebrity_tournamentes
if 'coins' in dct: self.coins = dct['coins']
if 'available_languages' in dct: self.available_languages = dct['available_languages']
if 'time' in dct: self.time = dct['time']
if 'unread_conversations' in dct: self.unread_conversations = dct['unread_conversations']
if 'total' in dct: self.total = dct['total']
if 'list' in dct:
self.games = []
for item in dct['list']:
game = Game()
game.parseJSON(item)
self.games.append(game)