title: How do I get seconds since 1/1/1970 of a Python datetime object?
body: <p>I'm using Python 3.7 and Django.  I wanted to get the number of seconds (or milliseconds) since 1/1/1970 for a datetime object.  Following the advice here -- <a href="https://stackoverflow.com/questions/7852855/in-python-how-do-you-convert-a-datetime-object-to-seconds">In Python, how do you convert a `datetime` object to seconds?</a>, I implemented</p>
  
  <pre><code>now = datetime.now()
  ...
  return [len(removed_elts) == 0, score, now.total_seconds()]
  </code></pre>
  
  <p>but the "now.total_seconds()" line is giving the error</p>
  
  <pre><code>AttributeError: 'datetime.datetime' object has no attribute 'total_seconds'
  </code></pre>
  
  <p>What's the right way to get the seconds since 1/1/1970?</p>