学过编程的人,知道这是什么意思吗?

通过字符串格式化,怎么把"想",安插在"想__了,没__过,""上面
- ?

z ="想"
print(想过了,没想过)

img

prinf("想%s了,没%s过", z, z)

#!/usr/bin/nve python
# coding: utf-8



'''通过字符串格式化,怎么把"想",安插在"想__了,没__过,""上面
- ?
z ="想"
print(想过了,没想过)'''


print(f"\n\n{' 模  板 ':~^48}\n{' 想__了,没__过,':~^44}\n")

print('一、老旧%占位符 python 3x已不建议使用。')

model = '想%s了,没%s过,'%('我', '想')
print(f"\n{'“%s”占位符':-^47}\n{model:>21}")

print('二、新式字符串格式化fotmat')

model = '想{}了,没{}过,'.format('家',  '想')
print(f"\n{'format字符串格式化':-^44}\n{model:>21}")


print('三、f"{}"插值字符串格式化,python3x推荐使用。')

model = f"想{'她'}了,没{'想'}过,"
print(f"\n{'“f{}”插值字符串格式化':-^42}\n{model:>21}")

img