mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
argparse howto: Use f-string in preference to "...".format() (GH-98883)
(cherry picked from commit 1fd20d0b57
)
Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
This commit is contained in:
parent
88736db5d6
commit
8b4d5b1047
1 changed files with 2 additions and 2 deletions
|
@ -732,9 +732,9 @@ your program, just in case they don't know::
|
||||||
if args.quiet:
|
if args.quiet:
|
||||||
print(answer)
|
print(answer)
|
||||||
elif args.verbose:
|
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:
|
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]``,
|
Note that slight difference in the usage text. Note the ``[-v | -q]``,
|
||||||
which tells us that we can either use ``-v`` or ``-q``,
|
which tells us that we can either use ``-v`` or ``-q``,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue