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

后端 未结 4 900
甜味超标
甜味超标 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:56

    it looks pretty, I don't know if a good performance.

    a = (1, 2, 3, 4, 5)
    x, y = a[0:2]
    

提交回复
热议问题