Multi-‐Line Statements in Python
- Jino Shaji
- Jan 17, 2015
- 1 min read
Updated: Jun 9, 2020
Statements in Python typically end with a new line. Python does, however, allow the use of the line continuation character (\) to denote that the line should continue.
For example: total = item_one + \ item_two + \ item_three
Statements contained within the [], {} or () brackets do not need to use the line continuation character. For example:
days = [‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’]
Commenti