首先,CSV文件:
txt,type
"MOGG
fgbf 假数据-文本--17",菜
"MOCK #GG
fgbf 假数据-文本--18",谱
"#美块
",菜
其次,代码
import pandas as pd
df=pd.read_csv('tt.csv')
for i in range(7):
print(df)
df.to_csv('tt2.csv',index=False)
df=pd.read_csv('tt2.csv')
然后,在win系统行为:
在linux行为:
mac系统如下:
有奖竞答:
1.为啥\R\N行为不一样,以及mac下是啥特点(上面有图)
2.win下甚至多系统下,怎么做到兼容(读出和写入行为一样)
with open('file1.csv',mode='w',newline='') as f:
df.to_csv(path_or_buf=f)