diff --git a/Lib/http/server.py b/Lib/http/server.py index 194a503c45f..a6100d48297 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -109,11 +109,10 @@ from http import HTTPStatus # Default error message template DEFAULT_ERROR_MESSAGE = """\ - - + + - + Error response @@ -777,14 +776,13 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): displaypath = urllib.parse.unquote(path) displaypath = html.escape(displaypath, quote=False) enc = sys.getfilesystemencoding() - title = 'Directory listing for %s' % displaypath - r.append('') - r.append('\n') - r.append('' % enc) - r.append('%s\n' % title) - r.append('\n

%s

' % title) + title = f'Directory listing for {displaypath}' + r.append('') + r.append('') + r.append('') + r.append(f'') + r.append(f'{title}\n') + r.append(f'\n

{title}

') r.append('
\n