read_csv,to_csv 前n行 pd.read_csv(file, nrows = 100) df.iloc[: 100, :].to_csv(out_file, index = False) Linux下查看前100行: head -100 123.txt