Message316072
When trying to print a type in a formatted string with padding TypeError is raised. See examples below.
These work:
>>> a = 'abc'
>>> print('{a}'.format(a=type(a)))
<class 'str'>
>>> print('{a}'.format(a=str(type(a))))
<class 'str'>
These don't:
>>> print('{a: >10}'.format(a=type(a)))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to type.__format__
>>> t = type(a)
>>> print('{a: >10}'.format(a=t))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to type.__format__ |
|
Date |
User |
Action |
Args |
2018-05-02 14:22:10 | alexomics | set | recipients:
+ alexomics |
2018-05-02 14:22:10 | alexomics | set | messageid: <1525270930.67.0.682650639539.issue33410@psf.upfronthosting.co.za> |
2018-05-02 14:22:10 | alexomics | link | issue33410 messages |
2018-05-02 14:22:10 | alexomics | create | |
|