title: How to run a method after a specific time interval in Python?
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> 
  def sendDataToServer():
    global temperature
   
  threading.Timer(5.0, sendDataToServer).start()
  print("Sensing...")
  readSensor()
  readCPUTemperature()
  temperature = round(temperature, 1)
  print(temperature)
  print(humidity)
  print(pressure)
  temp = "%.1f" % temperature
  hum = "%.1f" % humidity
  press = "%.1f" % pressure
  urllib.urlopen("http://www.teema.club/projectweather/add_data.php?temp=" + temp + "&amp;hum=" + hum + "&amp;pr=" + press).read()
   
  sendDataToServer()
   </code></pre>
  </div>
  </div>
  </p>
  
  <p>This is my Python code which sends some values to a server using a url with some parameters. I need to send this data to server after every 5 seconds. I tried to use a thread but it does not work.</p>
  
  <p>Can anyone tell me is it proper way to do this?</p>