I have a function that returns two variables. However, sometimes I just want to get the output of one variable. What's the most shorthand/concise way to do that? If I just try to set one variable I get a 'Too many values to unpack error'
I tried just leaving the first or second field blank. Look at the code below. Get the same error as before.
Problem:
def function:
return 1, 2
var1=function()
var1 == 1
Tried:
var1,=function()
I want a notation similar to:
var1,var2=function()
var1,=function()
so in this case var 1 should equal 1