Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open(path, 'rU')
- csv_reader = csv.reader(f)
- #getting x and y scales
- line1=csv_reader.next()
- self.x = (float(re.split('=',line1[2])[1]), float(re.split('=',line1[3])[1]))
- self.y = (float(re.split('=',line1[4])[1]), float(re.split('=',line1[5])[1]))
- csv_reader.next()
- line2 = csv_reader.next()[0].split('\t')
- coordinateDict = {} #dict of arrays of values
- coordinateLineNum = {} #dict of column num
- count = 0#count for the column num
- for line in line2:
- coordinateDict[line] = [] #empty array, but it is an array
- coordinateLineNum[line] = count
- count += 1
- print coordinateDict.__str__()
- print coordinateLineNum.__str__()
- for line in csv_reader:
- #each val from each line
- linesplit = line[0].split('\t')
- #each key in the map
- for key in line2:
- try:
- coordinateDict[key].append(float(linesplit[coordinateLineNum[key]])) #this means "get the number at this line
- #where the map's field would align at"
- except ValueError:
- print "Value Error occured while trying to read in array! Line: " + coordinateLineNum[key].__str__() + " field: " + key.__str__()
- break
Advertisement
Add Comment
Please, Sign In to add comment