old_contents: #!/usr/bin/env python3
  
  from gps.gps_class import GPS
  import time
  
  def main():
      gps_data = GPS('/dev/ttyS0')
      gps_data.start()
  
      while True:
          print("lat: {}, lon: {}, elevation: {}ft, speed: {}mph".format(
              gps_data.lat, gps_data.lon, gps_data.altitude, gps_data.mph))
          time.sleep(1)
  
  if __name__ == '__main__':
      main()
  
new_contents: #!/usr/bin/env python3
  
  from gps.gps_class import GPS
  import time
  import sys
  
  def main():
      gps_data = GPS('/dev/ttyS0')
      print("Press Control+C to stop.")
      gps_data.start()
  
      try:
          while True:
              print("lat: {}, lon: {}, elevation: {}ft, speed: {}mph".format(
                  gps_data.lat, gps_data.lon, gps_data.altitude, gps_data.mph))
              time.sleep(1)
      except KeyboardInterrupt:
          gps_data.stop()
          sys.exit(0)
  
  if __name__ == '__main__':
      main()
  
subject: Add while interrupt.