import numpy numpy.genfromtxt("word.txt", delimiter=‘,‘, dtype=str)
# => <class ‘numpy.ndarray‘>
# 一维向量 vector = numpy.array([1, 2, 3, 4]) print(vector.shape) # 二维矩阵 matrix = numpy.array([[5, 10, 15], [20, 25, 30]]) print(matrix.shape)
(4,) (2, 3)
原文:https://www.cnblogs.com/spaceapp/p/10646164.html