点击运行
import numpy as np list = range(5) it = iter(list) # 使用迭代器创建ndarray x = np.fromiter(it, dtype = float) print(x)
运行结果 :
正在执行...