Iterate over *args?

后端 未结 7 1428
借酒劲吻你
借酒劲吻你 2020-12-15 07:52

I have a script I\'m working on where I need to accept multiple arguments and then iterate over them to perform actions. I started down the path of defining a function and u

相关标签:
7条回答
  • 2020-12-15 08:18

    Just iterate over args:

    def userInput(ItemA, ItemB, *args):
        THIS = ItemA
        THAT = ItemB
        for arg in args:
            print arg
    
    0 讨论(0)
提交回复
热议问题