首页 > 其他 > 详细

array与List之间相互转化

时间:2018-05-29 12:24:04      阅读:260      评论:0      收藏:0      [点我收藏+]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/5/28 16:05
# @Author  : zhang chao
# @File    : test.py
import matplotlib.pyplot as plt
import numpy as np
alist=[1,2,3,4,5]
print("List转为array:")
aArray=np.array(alist)
print(aArray)
print("array 转为List:")
toList=aArray.tolist()
print(toList)

D:\Download\python3\python3.exe "E:/A正在学习/python data dig/aTest/test.py"
List转为array:
[1 2 3 4 5]
array 转为List:
[1, 2, 3, 4, 5]

Process finished with exit code 0

 

array与List之间相互转化

原文:https://www.cnblogs.com/ggzhangxiaochao/p/9104354.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!