Reputation: 65
In the following Python example:
a1, a2, ..., a30,
a31, a32, ..., a60 = get_values()
I can't insert a line-break after the variable a30
because if I do that the syntax is not correct. But then I do not know how I could correctly write code lines with any possible large length I might think of.
Upvotes: 2
Views: 901
Reputation: 8508
I am assuming you want to split an assignment statement into two lines.
Here's how to do it.
a1,a2,a3,a4, \
a5,a6,a7,a8 = list('abcdefgh')
print (a1, a2, a3, a4,
a5, a6, a7, a8)
The output of this will be:
a b c d e f g h
If you are going to store 60 variables using an assignment statement, I recommend using a list instead.
a = list('abcdefgh')
print (*a)
print (a[2])
The output of this will be:
a b c d e f g h
c
Upvotes: 3
Reputation: 65
I could do it eventually by adding brackets as follows:
(a1, a2, ................a30,
a31, a32, ..............a60) = get_values()
Upvotes: 2