PuppyPressPuppyPress
首页
项目的开始
库
JOKE
首页
项目的开始
库
JOKE
  • Python 字符串格式化方法对比

Python 字符串格式化方法对比

在日常开发中,有四种主流字符串插值方式,各有适用场景:

1. % 格式化(传统)

name = "Alice"
age = 30
print("Hello, %s. You are %d." % (name, age))
最近更新:: 2026/2/24 15:03