Files
python/pythonProject/格式化字符串/format/1.py
T
2026-05-18 17:58:02 +08:00

8 lines
243 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# format内的参数起始编号以0开始,即花括号引用的0表示第一个参数,1表示第二个参数
str = '''
窗前明月{0},
疑是地上{1},
举头望明{2},
低头思故{3}
'''
print(str.format('光','霜','月','乡'))