-2

This is the data of .txt file.(2 columns)

6.1101,17.592
5.5277,9.1302
8.5186,13.662
7.0032,11.854
5.8598,6.8233
8.3829,11.886
7.4764,4.3483
8.5781,12.0
6.4862,6.5987
5.0546,3.8166
5.7107,3.2522
buran
  • 13,682
  • 10
  • 36
  • 61

1 Answers1

1

you can use csv reader

import csv
x = []
y = []
with open('file.txt') as f:
    reader = csv.reader(f)
    for row in reader:
        x.append(float(row[0]))
        y.append(float(row[1]))

Output:

>>x
[6.1101, 5.5277, 8.5186, 7.0032, 5.8598, 8.3829, 7.4764, 8.5781, 6.4862, 5.0546, 5.7107]
>>y
[17.592, 9.1302, 13.662, 11.854, 6.8233, 11.886, 4.3483, 12.0, 6.5987, 3.8166, 3.2522]
ThePyGuy
  • 17,779
  • 5
  • 18
  • 45