Please see below code to understand my problem:
str_line = data['line'] # data['line'] holds "I was born in {year}"
str_year = '1987'
Expected output: I was born in 1987
print(str_line)
I have tried using following methods but the output always the original str_line
(i.e., I was born in {year}
).
str_line = str_line.replace('{{year}}',str_year)
and
str_line = str_line.replace('/{year/}',str_year)