Looks like you are parsing CSV data. Try to use csv.reader
and rewrite file reading section this way:
import csv
# ...
for i in range(nbr_files):
param_file = "./param_file_no_{0:0>9d}.txt".format(i)
with open(param_file, 'r') as f:
for row in csv.reader(f):
[param1, param2_txt, param3, param4_txt, param5_txt] = row
# ...
Also you could try to use Pandas or Polars for this, which are very optimized for column-based data and provide handy methods for working with CSV:
https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
https://docs.pola.rs/api/python/dev/reference/api/polars.read_csv.html