title: How to find the date n days ago in Python?
body: <p>I would like to write a script where I give Python a number of days (let's call it <code>d</code>) and it gives me the date we were <code>d</code> days ago.</p>
  <p>I am struggling with the module datetime:</p>
  <pre><code>import datetime 
  
  tod = datetime.datetime.now()
  d = timedelta(days = 50) 
  a = tod - h 
  Type Error : unsupported operand type for - : &quot;datetime.timedelta&quot; and 
  &quot;datetime.datetime&quot; 
  </code></pre>