enter image description here

How to set cell values as x,y,z,l,m,n,p,q,r variables in python without using pandas (ignore second set of coordinates)

So x=5000, y=300, z=2700, l=0.2, m=-1, n=0.1, p=0, q=0, r=0


1 Answer 1

import csv

def read_csv(file_name='your_file.csv'): # use \\ instead of \ in filepath
    with open(file_name) as csv_file:
        file = csv.reader(csv_file)
        return [i for i in file]

csvFileArray = read_csv()
row = csvFileArray[2]  # first row
x, y, z, l, m, n, p, q, r = row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9]

x = float(x)
y = float(y)
z = float(z)
l = float(l)
m = float(m)
n = float(n)
p = float(p)
q = float(q)
r = float(r)


Not the answer you're looking for? Browse other questions tagged .