Skip to content

Commit 1fd20d0

Browse files
authored
argparse howto: Use f-string in preference to "...".format() (#98883)
1 parent c053284 commit 1fd20d0

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
@@ -761,9 +761,9 @@ your program, just in case they don't know::
761761
if args.quiet:
762762
print(answer)
763763
elif args.verbose:
764-
print("{} to the power {} equals {}".format(args.x, args.y, answer))
764+
print(f"{args.x} to the power {args.y} equals {answer}")
765765
else:
766-
print("{}^{} == {}".format(args.x, args.y, answer))
766+
print(f"{args.x}^{args.y} == {answer}")
767767

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

0 commit comments

Comments
 (0)