Possible to append multiple lists at once? (Python)

后端 未结 7 542
清歌不尽
清歌不尽 2020-12-29 02:41

I have a bunch of lists I want to append to a single list that is sort of the \"main\" list in a program I\'m trying to write. Is there a way to do this in one line of code

7条回答
  •  我在风中等你
    2020-12-29 03:11

    To exactly replicate the effect of append, try the following function, simple and effective:

    a=[]
    def concats (lists):
        for i in lists:
            a==a.append(i)
    
    
    concats ([x,y,z])
    print(a)
    

提交回复
热议问题