Skip to content

Commit 3bb31f5

Browse files
committed
gh-130662: refine width/precision specification in format-spec
1 parent 75f38af commit 3bb31f5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Doc/library/string.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,10 @@ The general form of a *standard format specifier* is:
327327
width_and_precision: [`width_with_grouping`][`precision_with_grouping`]
328328
width_with_grouping: [`width`][`grouping_option`]
329329
precision_with_grouping: "." [`precision`]`grouping_option`
330-
width: `~python-grammar:digit`+
331330
grouping_option: "_" | ","
332-
precision: `~python-grammar:digit`+
331+
width: `digits`
332+
precision: `digits`
333+
digits: `~python-grammar:nonzerodigit` `~python-grammar:digit`*
333334
type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g"
334335
: | "G" | "n" | "o" | "s" | "x" | "X" | "%"
335336

0 commit comments

Comments
 (0)