将下面的alex字符串替换成SB

题目:将下面的alex字符串替换成SB

msg = 'hello alex'                         # 定义变量
msg1 = msg.replace('alex','SB')             # 将alex字符串替换成SB
print(type(msg1),msg1)

  输出结果:

<class 'str'> hello SB
View Code

 

posted @ 2017-06-25 17:38  御姐玫瑰  阅读(179)  评论(0编辑  收藏  举报
levels of contents