summaryrefslogtreecommitdiffstats
path: root/Lib/string.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/string.py')
-rw-r--r--Lib/string.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/string.py b/Lib/string.py
index 8bcd1dc..b57c79b 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -220,12 +220,14 @@ class Formatter:
def convert_field(self, value, conversion):
# do any conversion on the resulting object
- if conversion == 'r':
- return repr(value)
+ if conversion is None:
+ return value
elif conversion == 's':
return str(value)
- elif conversion is None:
- return value
+ elif conversion == 'r':
+ return repr(value)
+ elif conversion == 'a':
+ return ascii(value)
raise ValueError("Unknown conversion specifier {0!s}".format(conversion))