【问题标题】:csv.writer in Autodesk CSVAutodesk CSV 中的 csv.writer
【发布时间】:2012-12-08 16:09:36
【问题描述】:
29 csvfile=desfile+"\spv1.csv" 
30 csv_writer = csv.writer(csvfile)

我在 Python 中使用 AutodDesk CFD,这是我尝试将结果写入 csv 文件的部分。变量desfile是路径,一直报错

文件“C:/Users/Carlos/Documents/Inventor/Prototype Velocity Profile/Extracting Summary Stats for Expanding Models.py”,第 30 行,在

csv_writer = csv.writer('csvfile')

TypeError:参数 1 必须有一个“写”方法

我已尝试使用编写器插入分隔符选项,但仍然无法正常工作。有什么建议?

【问题讨论】:

    标签: python csv writer autodesk


    【解决方案1】:

    csv.writer 需要一个类似文件的对象,而不是字符串...

    试试:

    csv_writer = csv.writer(open(csvfile, 'wb'))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-18
      • 2018-05-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多