本文整理汇总了Python中card.Card.from_str方法的典型用法代码示例。如果您正苦于以下问题:Python Card.from_str方法的具体用法?Python Card.from_str怎么用?Python Card.from_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类card.Card
的用法示例。
在下文中一共展示了Card.from_str方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_showdown
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import from_str [as 别名]
def parse_showdown(self, parser, river):
# search for showdown title
parser.read_until(u'*** SHOW DOWN ***')
# showdown title line processed -> advance to next line
parser.read_line()
hands = []
# read until summary title concludes the showdown
while u'*** SUMMARY ***' not in parser.cline:
# skip mucked hands
if u'(mucked)' not in parser.cline:
try:
player = parser.before(':')
cards = Card.from_str(parser.between('[', ']'))
hand = Hand.from_cards(river + cards)
hands.append((hand, player))
except ValueError:
pass
# hand processed -> advance to next line
parser.read_line()
return hands
示例2: parse_river
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import from_str [as 别名]
def parse_river(self, parser):
# search for river title
parser.read_until(u'*** RIVER ***')
cards = Card.from_str(parser.between('[', ']'))
parser.read_line()
return cards