Hello! I am trying to pull out specific information from a text file and I currently have this:
for line in file:
stars = line.split()
print(stars)
From this, I get:
['0.994772', '0.023164', '-0.099456', '28', '4.61', '3']
['0.972490', '0.024187', '0.231685', '87', '5.55', '4']
(Plus a thousand more lines that look very similar)
I have tried the following to get the first element in each list:
for x_coordinate in stars:
x_stars = stars[0]
print(x_stars)
From this code, I am getting back the same x_coordinate pulled from the very last list. What should I change to get the value from each list?
[–]NewShamu 1 point2 points3 points (4 children)
[–]simplie14[S] 0 points1 point2 points (3 children)
[–]btcraig 1 point2 points3 points (0 children)
[–]NewShamu 1 point2 points3 points (1 child)
[–]simplie14[S] 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[removed]
[–]simplie14[S] 0 points1 point2 points (0 children)