'''
https://www.cnblogs.com/xiazhenyu/
*** 学而思之、思而记之、记而习之 ***
'''
stra = "8888"
strb = "幸运数字 8888"
strc = "666"
if stra in strb:
# 满足条件 ,使用新值替换旧值
strd = strb.replace(stra, strc) # 左边是旧值,右边是新值
print(strd) # 输出结果:幸运数字 666

相关文章:

  • 2021-06-21
  • 2021-09-12
  • 2021-08-02
  • 2021-11-19
  • 2022-12-23
  • 2021-10-19
  • 2023-03-22
猜你喜欢
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案