In a Flask tutorial, https://www.youtube.com/watch?v=cYWiDiIUxQc&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH&index=4 There is a syntax I want to understand
return f"Post('{self.title}', '{self.dateposted}')"
Can someone decompose this line for me?
- f string means to return the result of
Post()
in a string '{self.title}'
is an argument that is a string, because with''
{}
is used to get a variable.- But in the context
self.title
is ALREADY a string, why use' '
? Are my explanations correct? And what does' '
do here?