How to append multiple values to a list in Python

前端 未结 4 2015
醉梦人生
醉梦人生 2020-11-30 17:35

I am trying to figure out how to append multiple values to a list in Python. I know there are few methods to do so, such as manually input the values, or put the append oper

4条回答
  •  臣服心动
    2020-11-30 18:17

    Other than the append function, if by "multiple values" you mean another list, you can simply concatenate them like so.

    >>> a = [1,2,3]
    >>> b = [4,5,6]
    >>> a + b
    [1, 2, 3, 4, 5, 6]
    

提交回复
热议问题