print('aaa{0!r:.^5.3}aaa'.format('1234567'))
print('aaa{0:5.3f}aaa'.format(12.23))
# '!a' 应用 ascii() ,'!s' 应用 str(),'!r' 应用 repr()
Last active
February 28, 2022 10:12
-
-
Save notnotype/e9a9b45c6be63704393901797f0bde8c to your computer and use it in GitHub Desktop.
[python字符串格式化] #Python
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment