The Python Oracle

How do I create a multiline Python string with inline variables?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Peaceful Mind

--

Chapters
00:00 Question
00:44 Accepted answer (Score 235)
01:43 Answer 2 (Score 66)
02:20 Answer 3 (Score 61)
03:29 Answer 4 (Score 24)
04:09 Thank you

--

Full question
https://stackoverflow.com/questions/1011...

Accepted answer links:
[template strings]: http://docs.python.org/library/string.ht...

Answer 2 links:
[the accepted answer]: https://stackoverflow.com/a/10112665/815...
[String formatting]: https://docs.python.org/3.4/library/stri...
[PEP 3101 -- Advanced String Formatting]: http://www.python.org/dev/peps/pep-3101/

Answer 3 links:
[Python 3.6's f-strings]: https://stackoverflow.com/a/44205190/335...
[multi-line]: https://stackoverflow.com/q/10660435/335...

Answer 4 links:
[here]: https://www.python.org/dev/peps/pep-0498...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #string #variables #multiline

#avk47