本文整理汇总了Python中models.Player.persist方法的典型用法代码示例。如果您正苦于以下问题:Python Player.persist方法的具体用法?Python Player.persist怎么用?Python Player.persist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Player
的用法示例。
在下文中一共展示了Player.persist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_stats
# 需要导入模块: from models import Player [as 别名]
# 或者: from models.Player import persist [as 别名]
def set_stats(self):
# idea: make a directory structure of seasons / teams / players.txt
current_dir = os.path.dirname(os.path.abspath(__file__))
team_season_dir = os.path.join(current_dir, self.season, self.team, self.page[:self.page.index('_')])
os.makedirs(team_season_dir)
for record in self.players:
stat_dict = {}
for record_key in record.keys():
stat_dict[stat_attr_map[record_key]] = record[record_key]
current_player = Player(stat_dict, self.season, self.team)
current_player.persist(team_season_dir)