Python 格式字符列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4480278/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 15:55:54  来源:igfitidea点击:

List of Python format characters

pythonformatcharacter

提问by orange

I've been looking for the list Python format characters for a good 30 minutes. I can't find any.

我一直在寻找 Python 格式字符列表长达 30 分钟。我找不到任何。

Examples are

例子是

%d, %r

%d, %r

etc but I need a list with them along with a description if possible please.

等等,但如果可能的话,我需要一份清单以及一份说明。

采纳答案by Lennart Regebro

Here you go, Python documentation on old string formatting. tutorial -> 7.1.1. Old String Formatting -> "More information can be found in the [link] section".

给你,关于旧字符串格式的Python 文档。教程 -> 7.1.1。旧字符串格式 ->“更多信息可以在 [link] 部分找到”。

Note that you should start using the new string formattingwhen possible.

请注意,您应该尽可能开始使用新的字符串格式

回答by Lennart Regebro

回答by oceandreamer

In docs.python.org Topic = 5.6.2. String Formatting Operations http://docs.python.org/library/stdtypes.html#string-formattingthen further down to the chart (text above chart is "The conversion types are:")

在 docs.python.org 主题 = 5.6.2。字符串格式化操作 http://docs.python.org/library/stdtypes.html#string-formatting然后进一步向下到图表(图表上方的文字是“转换类型是:”)

The chart lists 16 types and some following notes.

该图表列出了 16 种类型和一些以下注意事项。

My comment: help does not include attitude which is a bonus. The attitude post enabled me to search further and find the info.

我的评论:帮助不包括作为奖励的态度。态度帖子使我能够进一步搜索并找到信息。