2

I have a configuration file as config.yaml, that look like this


misc.application_title: "ATT"

data_dir: "${APP_DIR}/aux_data" 

I have a function in app.py where it loads the config from yaml file. My question is how to load ${APP_DIR} as placeholder in the string. I have to load string placeholders while loading yaml file itself. Any leads will be appreciated .

iamniki
  • 553
  • 3
  • 11
  • Are you trying to fille the `APP_DIR` variable from inside the Python script? I am having a similar issue rn, trying to have a long python style string (with the {} inside of it) inside a file so that I can fill it from inside the program. – ffigari Jul 06 '22 at 04:22
  • I found a solution for it, If you have trouble let me know, I can answer it here – iamniki Jul 06 '22 at 07:15
  • 1
    I think I got it. I found another issue which was that I wanted to allow both using {} to print the curly braces and using {} to allow for the remplacement inside Python. But https://stackoverflow.com/questions/5466451/how-do-i-print-curly-brace-characters-in-a-string-while-using-format seems to have solved it – ffigari Jul 06 '22 at 14:32

0 Answers0