The Python Oracle

When to use %r instead of %s in Python?

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: Dreamlands

--

Chapters
00:00 Question
00:31 Accepted answer (Score 347)
01:22 Answer 2 (Score 20)
02:08 Answer 3 (Score 16)
02:28 Answer 4 (Score 14)
02:52 Thank you

--

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

Question links:
[Learn Python the Hard Way]: http://learnpythonthehardway.org/

Accepted answer links:
[str()]: https://docs.python.org/2/library/functi...
[repr()]: https://docs.python.org/2/library/functi...
[repr()]: https://docs.python.org/2/library/functi...
[repr()]: https://docs.python.org/2/library/functi...

Answer 2 links:
[this example]: http://learnpythonthehardway.org/book/ex...

--

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

--

Tags
#python #string #stringformatting

#avk47