Q:

How to output one value while the function returns two value in python？

In python, for example, a function returns two values, 
def f():
    return 1, 2 

while in some occasions I care about one of output values. In matlab, I can simply do
[out1, ~] = f()

But in python, how can I do. Thanks for the help!   

A:

It's pretty similar in Python: 
out, _ = f()

Note that this will only work with exactly two values. If you have more, you have to add an _, for each, unless you're using Python 3.x, which allows you to do this:
>>> x, *_ = [1,3,4,5]
>>> print _
[3, 4, 5]

