【Kata Daily 190918】Spacify(插空)

题目:

Modify the spacify function so that it returns the given string with spaces insertedbetween each character.

spacify("hello world") # returns "h e l l o   w o r l d"

解题办法:

def spacify(string):
    #your code here
    return ' '.join(list(string))

用时:5分59秒

 

知识点:

1、str转化为list:list(str)

2、list转化为str:''.join(list)

 

posted @ 2019-09-18 14:32  bcaixl  阅读(196)  评论(0编辑  收藏  举报