I’m wondering how to use an f-string whilst using r to get a raw string literal. I currently have it as below but would like the option of allowing any name to replace Alex I was thinking adding an f-string and then replacing Alex with curly braces and putting username inside but this doesn’t work with the r. Answer You
Tag: f-string
What does a star (asterisk) do in f-string?
In the python document 2.4.3. Formatted string literals, it seems possible to write a star followed by an expression in a f-string’s {}, but I cannot find how to use that. What’s that and how I can use it? Is it documented somewhere? To be exact, this is regarding “*” or_expr part of the following BNF. I tried it in
How can I do a dictionary format with f-string in Python 3 .6?
How can I do this format with a Python 3.6 F-String? Answer Well, a quote for the dictionary key is needed. f’My name {person[“name”]} and my age {person[“age”]}’