title: How to truncate and pad in python3 using just str.format?
body: <p>I would like to do this:</p>
  
  <pre><code>'{pathname:&gt;90}'.format(pathname='abcde')[-2:]
  </code></pre>
  
  <p>using string formatting instead of array indexing.
  So the result would be 'de'
  or in the case of pathname='e' the result would be ' e' with a space before e. If the index would be [2:] this question would be answered by <a href="https://stackoverflow.com/questions/24076297">How to truncate a string using str.format in Python?</a></p>
  
  <p>I need this in the following example:</p>
  
  <pre><code>import logging
  import sys
  logging.basicConfig(stream=sys.stdout, level=logging.INFO,style='{',format='{pathname:&gt;90}{lineno:4d}{msg}')
  logging.info('k')
  </code></pre>