How to create an integer array in Python?

前端 未结 8 731
旧巷少年郎
旧巷少年郎 2020-12-24 01:11

It should not be so hard. I mean in C,

int a[10]; 

is all you need. How to create an array of all zeros for a random size. I know the zero

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 01:50

    import numpy as np
    
    new_array=np.linspace(0,10,11).astype('int')
    

    An alternative for casting the type when the array is made.

提交回复
热议问题