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
No comments:
Post a Comment