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.

9
  • 13
    I would prefer either the triple quote notation or wrapping inside () to the \ character Commented Jan 3, 2016 at 9:32
  • 45
    I strongly advise to put the spaces at the beginning of the following lines instead of at the ending of the followed lines. This way an accidentally missing one is way more obvious (and thus is less likely to happen). Commented Dec 20, 2017 at 14:39
  • 1
    Also works with variables at the end of lines longStr = "account: " + account_id + \ ... Commented Dec 5, 2019 at 22:56
  • 3
    @Alfe No need to worry about missing \'s anymore. VScode will have a heart attack if I miss one Commented Jul 23, 2020 at 2:18
  • 9
    Both PEP 8 and Black discourage using backslashes for line continuation. Commented Nov 15, 2022 at 15:49