]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Use f-strings in csv docs example (GH-135245) (#135286)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 9 Jun 2025 06:41:03 +0000 (08:41 +0200)
committerGitHub <noreply@github.com>
Mon, 9 Jun 2025 06:41:03 +0000 (06:41 +0000)
Use f-strings in csv docs example (GH-135245)
(cherry picked from commit 2677dd017a033eaaad3b8e1e0eb5664a44e7e231)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Doc/library/csv.rst

index 5297be17bd708e3ce9d4ee1823b731f33b8a88d2..2e513bff651cd22bf34a9ceb07ff2ea0d33bf021 100644 (file)
@@ -609,7 +609,7 @@ A slightly more advanced use of the reader --- catching and reporting errors::
            for row in reader:
                print(row)
        except csv.Error as e:
-           sys.exit('file {}, line {}: {}'.format(filename, reader.line_num, e))
+           sys.exit(f'file {filename}, line {reader.line_num}: {e}')
 
 And while the module doesn't directly support parsing strings, it can easily be
 done::