name = \’XiaoMing\’
city = \’Fuzhou\’
1 C style
print(\”MyName: %s\\nMyCity: %s\” %(name, city))
2 {} format
print(\”MyName: {}\\nMyCity: {}\”.format(name, city))
3 f-string
print(f\”MyName: {name}\\nMyCity: {city}\”)
name = \’XiaoMing\’
city = \’Fuzhou\’
1 C style
print(\”MyName: %s\\nMyCity: %s\” %(name, city))
2 {} format
print(\”MyName: {}\\nMyCity: {}\”.format(name, city))
3 f-string
print(f\”MyName: {name}\\nMyCity: {city}\”)