import commands
f = open("test.txt","r").readlines()
for l in f:
x = l.strip()
url = ("https://"+x+"/test")
c = commands.getoutput("curl -I "+url)
print (c)
When the code is executed, the code takes a long time in this line [c = commands.getoutput("curl -I "+url)], I want to set a time for example 5 seconds. If it is longer than 5 seconds, move to the next line in the9 for loop)