Autodesk CSV中的csv.writer

see*_*spi 1 python csv writer autodesk

29 csvfile=desfile+"\spv1.csv" 
30 csv_writer = csv.writer(csvfile)
Run Code Online (Sandbox Code Playgroud)

我正在使用AutodDesk CFD和Python,这是我试图将结果写入csv文件的部分.变量desfile是路径,我不断收到错误

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

csv_writer = csv.writer('csvfile')
Run Code Online (Sandbox Code Playgroud)

TypeError:参数1必须具有"write"方法

我试过在编写器中插入分隔符选项,但仍然无法正常工作.有什么建议?

Jon*_*nts 6

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

尝试:

csv_writer = csv.writer(open(csvfile, 'wb'))
Run Code Online (Sandbox Code Playgroud)