1 把txt讀取成ndarray數(shù)組 txt = np.loadtxt(txt_path, dtype=str) 2 把txt內(nèi)容每一行讀取成list with open(p) as t: t = t.read().strip().splitlines()