• Pandas写入CSV格式


    import pandas as pd
    def putDataIntoCsv(dataContents, fileName):

    save = pd.DataFrame(dataContents, columns=titles)
    if (os.path.exists(fileName)):
    file = open(fileName, "a", encoding='utf-8')
    save.to_csv(file, header=False, line_terminator=" ", index=False)
    file.close()
    print("添加完成")
    else:
    file = open(fileName, "w", encoding='utf-8')
    save.to_csv(file, line_terminator=" ", index=False)
    file.close()
    print("新建完成")
    # 释放
    return []
  • 相关阅读:
    2020/5/8
    2020/5/8
    2020/5/6
    2020/4/30
    2020/4/29
    2020/4/28
    2020/4/27
    KMP算法详解
    博客搬家声明
    洛谷P2831 NOIP2016 愤怒的小鸟
  • 原文地址:https://www.cnblogs.com/yp19970/p/12604168.html
Copyright © 2020-2023  润新知