Problem Statement: You are calling a function that returns a list of values when you know that there’s only one result.  It will be a singleton list, but you don’t want to bother with that you just want the value of the first element.

Generic solution: put a [0] at the end of the expression:

values = getValues()[0]

Smart solution: Just put a comma (,) at the end of the variable:

values, = getValues()
Advertisement