标签:one bsp 结果 pre import 简单介绍 简单 float nbsp
import numpy as np ret = np.arange(3) print(ret) """ 运行结果 [0 1 2] """
import numpy as np
ret = np.array([1,2,3,4])
print(ret)
"""
运行结果
[1 2 3 4]
"""
import numpy as np
ret = np.ones(5)
print(ret)
ret2 = np.zeros(7)
print(ret2)
ret3 = ret.astype(np.int32)
print(ret3)
"""
运行结果
[1. 1. 1. 1. 1.]
[0. 0. 0. 0. 0. 0. 0.]
[1 1 1 1 1]
"""
import numpy as np
ret = np.array([1,2,3,4],dtype=np.float32)
print(ret)
ret2 = ret.astype(np.int32)
print(ret2)
"""
运行结果
[1. 2. 3. 4.]
[1 2 3 4]
"""
标签:one bsp 结果 pre import 简单介绍 简单 float nbsp
原文地址:https://www.cnblogs.com/xaiobong/p/10074745.html