Passing an Array/List into Python

前端 未结 5 2098
耶瑟儿~
耶瑟儿~ 2020-12-12 13:31

I\'ve been looking at passing arrays, or lists, as Python tends to call them, into a function.

I read something about using *args, such as:

def some         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 14:12

    Python lists (which are not just arrays because their size can be changed on the fly) are normal Python objects and can be passed in to functions as any variable. The * syntax is used for unpacking lists, which is probably not something you want to do now.

提交回复
热议问题