1

I am new to python , One command in my code is taking long time to execute and I need to execute it multiple time according to a list.I want to implement mutithreading here .In below code getcmdresult is taking a long time to return a value .Can someone please suggest how I can use mutithreading to reduce the time. Thanks in advance.

def getcmdresult(cmd, query):
    #process to return a json array
    return json_array


def get_details(list, query):
    resultlist=[]

    for item in list:
        cmd = "cmd "+item["name"]
        value=getcmdresult(cmd, query)
        resultlist.append(value)

    return resultlist
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Pooja
  • 13
  • 4

0 Answers0