I've read PEP498 and multiple articles, forums, etc and finally reached a point when I am asking you ppl for help. Yes, I accept a possibility that maybe I simply did not understand what I read :) so would appreciate that pointing out too ;P
First the code then my use case. I want to do this but with f strings:
input = 'this is {some} input.'
some = 'test'
print(input.format(some=some))
> this is test input.
So I have a string variable with a "{some}" variable to later be changed by str.format() How can I do it with f strings? I know I can pass a string variable into an f string but how can I affect the {some} variable within that string variable itself?
input = 'this is {some} input.'
some = 'test'
print(f'{input}')
> this is {some} input.
USE CASE:
What I am trying to do is to read a file containing a sql query with parameters. I need to be able to change the tables in the FROM section of the query. these cannot be sql parameters as its not supported. Hence I am reading the file and want it to contain a "{table}" variable placeholder which I can then format when reading in the file. I am able to do it with the .format() method but I am curious if anyone can answer this using f strings.