title: Write date and variable to file
body: <p>I am trying to write a variable and the date and time on the same line to a file, which will simulate a log file.</p>
  
  <p>Example: <code>July 25 2018 6:00 pm - Variable contents here</code></p>
  
  <p>So far I am able to write the variable to the file but I am unsure how to use the datetime library or other similar libraries. Some guidance would be appreciated.</p>
  
  <p>Below is the current script.</p>
  
  <pre><code>import subprocess
  import datetime
  var = "test"
  
  with open('auditlog.txt', 'a') as logfile:
      logfile.write(var + "\n")
  </code></pre>