KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
There are a lot of examples of reading CSV data using Python, like this one: import csv with open('some.csv', newline='') as f: reader = csv.reader(f) for row in reader: print(row) I only want to read one line of data and enter it into various variables. How do I do that? My code only retrieves the value for i , and none of the other values: reader = csv.reader(csvfile, delimiter=',', quotechar='"') for row in reader: i = int(row[0]) a1 = int(row[1]) b1 = int(row[2]) c1 = int(row[2]) x1 = int(row[2]) y1 = int(row[2]) z1 = int(row[2])
Tags (comma-separated)
Save Edits
Cancel