title: Calling class method inside string format
body: <p>Consider this:</p>
  <pre class="lang-py prettyprint-override"><code>from datetime import datetime
  
  now = datetime.now() 
  now.strftime(&quot;%p&quot;) # returns 'PM'
  '{0.day}'.format(now) # returns 22
  
  '{0.strftime(&quot;%p&quot;)}'.format(now)
  # gives
  # AttributeError: 'datetime.datetime' object has no attribute 'strftime(&quot;%p&quot;)'
  
  </code></pre>
  <p>This seems to imply that I can't call a class method inside the format (I guess that's what <code>strftime</code> is).</p>
  <p>What's a workaround for this (assuming I need to call the method inside the string, and keep using a format) ?</p>