python实现合并两个数组的方法

yipeiwu_com6年前Python基础

本文实例讲述了python实现合并两个数组的方法。分享给大家供大家参考。具体如下:

python合并两个数组,将两个数组连接成一个数组,例如,数组 a=[1,2,3] ,数组 b=[4,5,6],连接后:[1,2,3,4,5,6]

方法1

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

方法2

a=[1,2,3]
b=[4,5,6]
a.extend(b)

希望本文所述对大家的Python程序设计有所帮助。

相关文章

python配置grpc环境

gRPC 的安装: $ pip install grpcio 安装 ProtoBuf 相关的 python 依赖库: $ pip install protobuf 安装 python...

Python实现按逗号分隔列表的方法

方法一: def commaSpiltList(self, listData): listData = list(listData) strs = str(listData[0]...

浅谈python可视化包Bokeh

本文研究的主要是python可视化包Bokeh的相关内容,具体如下。 问题:需要把pandas的数据绘图并通过网页显示,matplotlib需要先保存图像,不合适。 解决:在网上搜了一下...

Python安装官方whl包和tar.gz包的方法(推荐)

Windows环境:   安装whl包:pip install wheel    ->    pip install&n...

python获取指定日期范围内的每一天,每个月,每季度的方法

1.获取所有天,返回一个列表: def getBetweenDay(begin_date): date_list = [] begin_date = datetime.dat...