Pass multiple arguments in form of tuple

This question already has an answer here:

  • What does ** (double star/asterisk) and * (star/asterisk) do for parameters? 15 answers

  • 您可以使用*运算符来解压参数列表:

    input_tuple = (1,2,3)
    instance_1 = InputStuff(*input_tuple)
    

    您正在寻找: Unpacking Argument Lists

    >>> range(3, 6)             # normal call with separate arguments
    [3, 4, 5]
    >>> args = [3, 6]
    >>> range(*args)            # call with arguments unpacked from a list
    [3, 4, 5]
    
    链接地址: http://www.djcxy.com/p/9068.html

    上一篇: Python函数参数* x,这是什么意思?

    下一篇: 以元组形式传递多个参数