Return a tuple of arguments to be fed to string.format()

前端 未结 3 478
清酒与你
清酒与你 2020-12-13 18:10

Currently, I\'m trying to get a method in Python to return a list of zero, one, or two strings to plug into a string formatter, and then pass them to the string method. My c

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 18:38

    This attempts to use "cards" as single format input to print, not the contents of cards.

    Try something like:

    print('Two pair, %ss and %ss' % cards)
    

提交回复
热议问题