本文整理汇总了Python中card.Card.id方法的典型用法代码示例。如果您正苦于以下问题:Python Card.id方法的具体用法?Python Card.id怎么用?Python Card.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类card.Card
的用法示例。
在下文中一共展示了Card.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_card
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import id [as 别名]
def create_card(self, data):
data = json.loads(data)
card = Card()
card.set = data['set']
card.question = data['question']
card.hint = data['hint']
card.answer = data['answer']
d_set = self.__find_set(card.set)
if d_set is None:
d_set = CardSet(card.set)
self.sets.append(d_set)
max_id = 0
for c in d_set.cards:
if int(c.id) >= int(max_id):
max_id = int(c.id) + 1
card.id = str(max_id)
card.save(self.config)
d_set.cards.append(card)
return card.id
示例2: Card
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import id [as 别名]
f.write(return_string)
f.write("]\n")
#f.write("}\n")
#
#
#Generating card JSON Objects
#
#
for cards in root.findall('cards'):
for card in cards.findall('card'):
temp_card = Card()
temp_card.id = card.find('id').text
temp_card.name = card.find('name').text
temp_card.set = card.find('set').text
temp_card.type = card.find('type').text
temp_card.rarity = card.find('rarity').text
temp_card.manacost = card.find('manacost').text or "Default"
temp_card.converted_manacost = card.find('converted_manacost').text or "Default"
temp_card.power = card.find('power').text or "Default"
temp_card.toughness = card.find('toughness').text or "Default"
temp_card.loyalty = card.find('loyalty').text or "Default"
temp_card.ability = card.find('ability').text or "Default"
#temp_card.flavor = card.find('flavor').text or "Default"
if temp_card.id == 74256:
temp_card.flavor = "Default"