Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 6013

Import CSV

$
0
0

@onrender wrote:

Hello,

I would like to use data (text, numbers) from CSV and organize everything into a dictionary. "import csv" standard python function does not work. Is only the rs.OpenFileName() the way?

import csv
reader = csv.DictReader(open('test.csv'))

result = {}
for row in reader:
    for column, value in row.iteritems():
        result.setdefault(column, []).append(value)
print result

EDIT:
Ok, I found answer that it does not exist in IronPython; http://www.ironpython.info/index.php?title=Reading_CSV_Files, now looking for solution :slight_smile:

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6013

Trending Articles