I'd suggest to use
pandas
. There's a method called
pandas.read_csv — pandas 1.5.3 documentation[
^].
This is very fast and flexible.
[EDIT]
Imagine, you've got such of file:
-3153.61743,-6115.18164,-3289.31226
-3256.75195,-6075.70801,-3550.83057
-3775.00977,-5870.36035,-3817.91870
-3890.03223,-5819.92871,-3797.58984
-4134.60156,-5724.16309,-3651.39648
There's no header and a comma is used as a column separator. Then:
import pandas as pd
filename = 'FullFileNameHere.txt'
df = pd.read_csv(filename, delimiter=',',usecols=[0,2],header=None)
print(df)
a = df[0]
print(a[4])
That's all! Try it!