https://github.com/python/cpython/commit/f9b37d4d261dca569153a3c2f00d580d03453bc2 commit: f9b37d4d261dca569153a3c2f00d580d03453bc2 branch: 3.10 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: miss-islington <31488909+miss-islington at users.noreply.github.com> date: 2022年11月02日T19:16:33-07:00 summary: argparse howto: Use f-string in preference to "...".format() (GH-98883) (cherry picked from commit 1fd20d0b57478d8b0d8d58718fa773135348bf98) Co-authored-by: Skip Montanaro <skip.montanaro at gmail.com> files: M Doc/howto/argparse.rst diff --git a/Doc/howto/argparse.rst b/Doc/howto/argparse.rst index a97d10cfe6bb..adc2f37371a9 100644 --- a/Doc/howto/argparse.rst +++ b/Doc/howto/argparse.rst @@ -732,9 +732,9 @@ your program, just in case they don't know:: if args.quiet: print(answer) elif args.verbose: - print("{} to the power {} equals {}".format(args.x, args.y, answer)) + print(f"{args.x} to the power {args.y} equals {answer}") else: - print("{}^{} == {}".format(args.x, args.y, answer)) + print(f"{args.x}^{args.y} == {answer}") Note that slight difference in the usage text. Note the ``[-v | -q]``, which tells us that we can either use ``-v`` or ``-q``,