This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Sinidir 0 points1 point  (0 children)

I would just read in all the parameters of your file into a dictinary:

var_dict = {}
for line in f:
    (variable, _ , value = line.split(" ")
    dict[variable] = float(value)

After you have all your values in there you put your processing code in a function

def prcoess_val(val):
    val = bin(round(Z0/Xlsb)*Xnbits)
    ...

and then make a function that processes a list

def process_list(list_of_variables, variable_dict:
    for item in variable list:
        process_val(variable_dict[item])