在Python中,格式化字符串主要有三种方式:百分号()格式化(旧式,不推荐在新代码中使用)str.format()方法(较新,功能强大,灵活)f-strings(格式化字符串字面量)(Python3.6+推荐,最简洁...