Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c02/c02_06 #13

Open
utterances-bot opened this issue Apr 23, 2023 · 1 comment
Open

c02/c02_06 #13

utterances-bot opened this issue Apr 23, 2023 · 1 comment

Comments

@utterances-bot
Copy link

2.6 【基础】字符串格式化 — Python中文指南 1.0 documentation

https://python.iswbm.com/c02/c02_06.html

Copy link

还有一些其实也很有用的字符串格式化方法,比如第二种里面的format,后面参数是可以放可迭代类型的,举个例子“{0} {1[0]} {1[1]} {1[2]}”.format(a, [b, c, d])。
还有一个是数字的格式化在第二种和第三种方法里面都可以加一个:来对数字格式化,比如说
“{val:.2f}”.format(随便一个float),f“{num:02X}”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants