python中可以通过数组的extend方法对原数组进行扩展的方法来实现数组的合并,也可以通过加号操作符进行合并
c1 = ["Red","Green","Blue"] c2 = ["Orange","Yellow","Indigo"] c1.extend(c2) assert c1 == ["Red","Green","Blue","Orange","Yellow","Indigo"]
下面使用+号操作符
c1 = ["Red","Green","Blue"] c2 = ["Orange","Yellow","Indigo"] c3 = c1 + c2 assert c3 == ["Red","Green","Blue","Orange","Yellow","Indigo"]