美文网首页
作业四:字符串2

作业四:字符串2

作者: 大冰S | 来源:发表于2019-11-20 22:21 被阅读0次
  • 字符串‘ hello ’,使用字符串的方法去除空格
  • 将字符串“you need python”中的空格用*替代

字符串‘ hello ’,使用字符串的方法去除空格

s = ' hello '
s.strip()
'hello'

将字符串“you need python”中的空格用*替代

s = 'you need python'
s.replace(' ','')
'you
need*python'

相关文章

网友评论

      本文标题:作业四:字符串2

      本文链接:https://www.haomeiwen.com/subject/bplybctx.html