Home > Blockchain >  Get split value from two zip list
Get split value from two zip list

Time:04-02

i have this two lists and i need to zip them and then i need to get one of the values

for x in heapq.nlargest(5, zip(list1,list2)):     
    print("->: ",x)

This prints ->: (9.99, 'SFO-RE.0025')

I need to get the 9.99 in order to run it thru another function evval('9.99')

I was hopping that someone could help me get this value

CodePudding user response:

heapq.nlargest returns a list, so use x[0] to get the first item in x.

https://docs.python.org/3/library/heapq.html

https://realpython.com/lessons/indexing-and-slicing/

  • Related