zoukankan      html  css  js  c++  java
  • array与List之间相互转化

    #!/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:Downloadpython3python3.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
  • 相关阅读:
    day11
    day10
    day9
    day8
    day7
    day6
    day14
    day13
    day12
    day11
  • 原文地址:https://www.cnblogs.com/ggzhangxiaochao/p/9104354.html
Copyright © 2011-2022 走看看