2

I have the following code

def latex_template(name, title):
return '\n'.join((r"\begin{figure}[ht]",
                  r"    This is a custom LaTeX template!",
                  r"    \centering",
                  rf"    \incfig[1]{{{name}}}",
                  rf"    \caption{{{title}}}",
                  rf"    \label{{fig:{name}}}",
                  r"\end{figure}"))

and I would like to figure out what is the difference between r and rf. Per google, I get that r means that python should just write out the text as it is. For rf, I get that it has something to do with functions. Is it that with rf we tell python to write what I have but also substituing variables, without executing nothing.

Is this right?

1

1 Answer 1

2

It's just a combination of an f-string and r-string.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.