nic
nic

Reputation: 11

Writing csv-file with IronPython (in Ansys Mechanical)

I am trying to export data from Ansys Mechanical by writing into a csv file. Unfortunately with my code the charakters in my lists don´t get seperated by the comma. They just end up in one cell and I can't figure out why. Thanks allot

Here are an example of my code and results

import csv
csv_outfile = r'Z:\Ansys\05-11-2022_output.csv'
with open(csv_outfile, 'wb') as ofile:
    write = csv.writer(ofile)
    write.writerow(['1' ,'2' ,'3'])

enter image description here

Upvotes: 1

Views: 694

Answers (1)

ghareeb fathy
ghareeb fathy

Reputation: 475

with open('test.csv', 'w') as ofile:
    write = csv.writer(ofile)
    write.writerow(i for  i in ['1' ,'2' ,'3']) # 

Change wb to w Because you write numbers

Upvotes: 1

Related Questions