The data in the file looks like this; two columns that need to represent X and Y values. The first value in the will be X values and second value will be Y values.
42.10 8.55
40.25 7.60
38.50 8.95
39.55 6.45
40.90 7.75
I need to read it into python and assign variables to each set of values in each line: for example, (42.10,8.55) where 42.10 is the x value and 8.55 is the y value. There are several lines of values that need this kind of organization. I can open the file and read it in however I can't get the variable assignments I want.
so far I have
with open ("file.txt", "r") as myfile:
data=myfile.read().split()
Ok, so now here's where I'm at now:
with open('file.txt') as f:
data = [line.split() for line in f.readlines()]
out = [(float(x), float(y)) for x, y in data]
for i in out:
print i
I want to create a scatter plot of the data in the for Loop, which module would you recommend?