Appending a list to itself in Python

前端 未结 5 2302
盖世英雄少女心
盖世英雄少女心 2021-01-05 06:08

I want to attach a list to itself and I thought this would work:

x = [1,2]
y = x.extend(x)
print y

I wanted to get back [1,2,1,2]

5条回答
提交回复
热议问题