I'm having trouble with unpacking a large number of variables from list of tuples. How can I make the unpacked variables span multiple lines?
I want to change
for t,a,f,b,s,x,j,p,w,q in results:
print(t,s,x)
to
for t,a,f,b,s,x,
j,p,w,q in results:
print(t,s,x)
CodePudding user response:
Another option (with round brackets):
for (t, a, f, b, s, x,
j, p, w, q) in results:
print(t, s, x)
CodePudding user response:
You can use \
at the end of each line, to spread your python code across the multiple lines.
for t,a,f,b,s,x, \
j,p,w,q in results:
print(t,s,x)
CodePudding user response:
You could just ask Black. When you have something actually too long for one line (i.e., like your "the actual variable names are a lot longer", not like your question's example which doesn't show the issue), it uses parentheses.