I'd like to build a tool where fstring formats are stored in a configuration file.
config = load_config()
def build_fstring(str):
  return ...   # <-- issue is there
chosen_format = config.get("chosen_format")  # returns '{k},{v}'
fstring = build_fstring(chosen_format) # may return something like 'f"{k},{v}"'
for (k,v) in d.items():
  print(fstring)  # fstring is evaluated here
My issue is that fstring is compiled before variables are known.
Is there a way to do it ?
 
    