Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error in Format Specification Mini-Language concerningprecision_with_grouping in 3.14 #134449

Open
Assignees
skirpichev
Labels
3.14bugs and security fixes3.15new features, bugs and security fixesdocsDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or error
@jonathanpoelen

Description

@jonathanpoelen

Documentation

On this page:https://docs.python.org/3.14/library/string.html#grammar-token-format-spec-format_spec

format_spec:             [options][width_and_precision][type]options:                 [[fill]align][sign]["z"]["#"]["0"]fill:<anycharacter>align:"<"|">"|"="|"^"sign:"+"|"-"|" "width_and_precision:     [width_with_grouping][precision_with_grouping]width_with_grouping:     [width][grouping]precision_with_grouping:"." [precision][grouping]width:digit+precision:digit+grouping:","|"_"type:"b"|"c"|"d"|"e"|"E"|"f"|"F"|"g"|"G"|"n"|"o"|"s"|"x"|"X"|"%"

Theprecision_with_grouping syntaxe is wrong, because it accepts. withoutprecision orgrouping. But

>>>f'{1234.1234:.f}'Traceback (mostrecentcalllast):File"<python-input-17>",line1,in<module>f'{1234.1234:.f}'^^^^^^^^^^^^^^ValueError:Formatspecifiermissingprecision

(The error does not mention grouping either)

The right syntax should be

precision_with_grouping:"."precision [grouping]|"."grouping

Metadata

Metadata

Assignees

Labels

3.14bugs and security fixes3.15new features, bugs and security fixesdocsDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or error

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp