I am trying to ping multiple host to check communication. Below is my script and it works fine. I am giving the server names as test226693 test226693 test226825 but would like to give the server name in the new line like below as I have more server list so cannot put everything in each line.
currently it is: Enter the server name: test226693 test226745 test226825
Wanted to give the server names like below and get the output and line to print "you are going to do ping test 5 clients.The number 5 will vary based on the input.
test226693
test226745
test226825
test226889
test227082
def ping():
server_names=input("Enter the server name: \n")
server_names=server_names.split(" ")
for servers in server_names:
command = f"ping {servers}"
output=subprocess.Popen((command),shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE).communicate()[0]
print(output)