8000 argparse howto: Use f-string in preference to "...".format() (GH-98883) · python/cpython@8b4d5b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b4d5b1

Browse files
argparse howto: Use f-string in preference to "...".format() (GH-98883)
(cherry picked from commit 1fd20d0) Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
1 parent 88736db commit 8b4d5b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/howto/argparse.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,9 @@ your program, just in case they don't know::
732732
if args.quiet:
733733
print(answer)
734734
elif args.verbose:
735-
print("{} to the power {} equals {}".format(args.x, args.y, answer))
735+
print(f"{args.x} to the power {args.y} equals {answer}")
736736
else:
737-
print("{}^{} == {}".format(args.x, args.y, answer))
737+
print(f"{args.x}^{args.y} == {answer}")
738738

739739
Note that slight difference in the usage text. Note the ``[-v | -q]``,
740740
which tells us that we can either use ``-v`` or ``-q``,

0 commit comments

Comments
 (0)
0