title: How to detect if string has changed
body: <p>I want to check if a specific string has changed from values.
  The values always change over time. I only want to do an action if the string has changed.
  The string gets its value from a text file. So i want to know if the text file has changed.
  I don't know what the best way is to do this.</p>
  
  <pre><code>with open(settings.txt, 'r') as text_file:
          custom_string = text_file.read().split("\n")[1]
  
  if #custom_string has changed
      print("string has changed to", custom_string)
  </code></pre>