Is it possible to unpack a tuple in Python without creating unwanted variables?

后端 未结 4 917
甜味超标
甜味超标 2020-12-29 02:21

Is there a way to write the following function so that my IDE doesn\'t complain that column is an unused variable?

def get_selected_index(self):
           


        
4条回答
  •  暖寄归人
    2020-12-29 02:46

    If you don't care about the second item, why not just extract the first one:

    def get_selected_index(self):
        path = self._treeView.get_cursor()[0]
        return path[0]
    

提交回复
热议问题