title: Output result of a ping with subprocess.call to a text file
body: <p>I'm attempting to ping an IP address in Windows with Python. I want to output the result of the ping into a text file, but I don't know how to do that with the subprocess.call function. I know how to write variables to a file, but I don't know how to assign anything from the subprocess.call to a variable.</p>
  
  <p>For example, if I pinged, I would want the text file to look like this</p>
  
  <pre><code>Pinging 127.0.0.1 with 32 bytes of data:
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Ping statistics for 127.0.0.1:
      Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  Approximate round trip times in milli-seconds:
      Minimum = 0ms, Maximum = 0ms, Average = 0ms
  </code></pre>
  
  <p>How would I do this?</p>