码迷,mamicode.com
首页 > 编程语言 > 详细

python将两个数组合并成一个数组的两种方法的代码

时间:2019-02-07 16:22:18      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:过程   使用   常用   xtend   orange   帮助   pytho   个数   bsp   

内容过程中,把写内容过程中常用的内容收藏起来,下面的资料是关于python将两个数组合并成一个数组的两种方法的内容,希望能对小伙伴们有帮助。
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"]




 

python将两个数组合并成一个数组的两种方法的代码

标签:过程   使用   常用   xtend   orange   帮助   pytho   个数   bsp   

原文地址:https://www.cnblogs.com/javahouse/p/10354818.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!