Python multi-dimensional array initialization without a loop

前端 未结 12 1035
梦谈多话
梦谈多话 2020-12-13 22:26

Is there a way in Python to initialize a multi-dimensional array / list without using a loop?

12条回答
  •  孤街浪徒
    2020-12-13 23:01

    If you're doing numerical work using Numpy, something like

    x = numpy.zeros ((m,n))
    x = numpy.ones ((m,n))
    

提交回复
热议问题