This will be easier to explain with an example. Let's say I have a settings.py file that looks like this:
settings.py
a_string='This string should contain {value} <<< here.'
I then import settings into my .py file, where I have a function mystring that looks something like this (note the function does not work as I would like it to):
import settings
def mystring(value='100'):
b_string=f'{settings.a_string}'
return b_string
print(mystring())
# I would like this to return:
# "This string should contain 100 <<< here."
I have tried placing the f-string formatting inside settings.py, such as:
a_string="f'This string should contain {value} <<< here.'"
to no avail. No luck if I place it in the function or function call either.
I feel like I am missing something obvious, but I just can't see it, so any pointers would be much appreciated.
a = f'...'is executed,ais as "normal" as any other stringa_stringis not an f-string, it's just a regular string containing the literal text{value}.evalorexec).format()