How to ping from a tuple?
<p>How can I ping a list of hosts from a tuple and store the response into another tuple, list?</p>

<p>I know how to ping a single host:</p>

<pre><code>hostname = "10.0.0.250" #example

response = os.system("ping -c 1 " + hostname)
</code></pre>

<pre><code>hostnames = ["10.0.0.1", "10.0.0.2"]
# Can use a tuple instead of list.
responses = [os.system("ping -c 1 " + hostname) for hostname in hostnames]
# You can enwrap the list comprehension in a call to the tuple() function
# to make `responses` a tuple instead of list.
</code></pre>

python