Search code examples
pythonpython-3.xstringformatrawstring

can there be problems due to the wrong order in fr""?


I can do fr"" and rf"" in python.
As far as I understand, here the order may be important, but I would like to understand if this is so?
And if that is, then I want to see an example, which will show possible problems.
It would also be interesting to hear about order issues, including the remaining u and b.
For example, fbr, what about it?


Solution

  • The order of f and r doesn't matter. Here's what I found from the docs:

    'f' may be combined with 'r' or 'R', in either order, to produce raw f-string literals. 'f' may not be combined with 'b': this PEP does not propose to add binary f-strings. 'f' may not be combined with 'u'.