0

I have this:

new_list = list_a + list_b + list_c

I want to format it so it looks like this:

new_list =
     list_a +
     list_b +
     list_c

for readability and QA purposes, how can I do this? When I try to do this, I get an Invalid Format error.

Edit: This does not answer my question: How can I do a line break (line continuation) in Python?

When I try to do the following:

new_list = (
     a,
     b,
     c
)

I get this:

new_list

[[values_from_list_a],[values_from_list_b],[values_from_list_c]]

I want this:

['values_from_list_a','values_from_list_b','values_from_list_c']

1 Answers1

2

Use parentheses

new_list = (
  list_a + 
  list_b + 
  list_c
)
Eric Truett
  • 2,970
  • 1
  • 16
  • 21