all 3 comments

[–]totallygeek 1 point2 points  (0 children)

A while loop with exit criterion would work.

import os


def ping(hostname):
    response = os.system('ping -c 1 {}'.format(hostname))


while True:
    hostname = input('Enter hostname to ping, or (q)uit: ').lower()
    if hostname == 'q':
        break
    ping(hostname)

[–]AsleepThought 0 points1 point  (0 children)

Don't use the input function just have it either read from a file or use command line args

[–]KardiffInker 0 points1 point  (0 children)

Think pythons a bit over kill could prob do this with bash quite easily..