1 把txt读取成ndarray数组 txt = np.loadtxt(txt_path, dtype=str) 2 把txt内容每一行读取成list with open(p) as t: t = t.read().strip().splitlines()