Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 1
    The 3rd one looks neat, but I remember this way kinda deprecated? is that true? Commented Aug 3, 2012 at 2:52
  • 10
    There is also, for the lazy, print "foo is %(bar)s" % locals(). Commented Aug 3, 2012 at 2:58
  • 1
    @yozloy - correct it is deprecated in Python 3 (as I understand it). Commented Aug 3, 2012 at 2:58
  • 1
    the % syntax is no longer deprecated in Python 3: stackoverflow.com/a/23381153/770425 Commented Dec 18, 2015 at 1:48
  • 1
    This is incorrect since 3.6 introduced f-strings Commented Sep 7, 2018 at 1:01