#将字符串中以空格为分隔符加入到列表l中
#再将l中元素以空格为分隔符连接成新的字符串,否则返回的是列表
class Solution:
def reverseWord(self , str: str) -> str:
# write code here
l=[]
for i in str.split(' '):
l.append(i[::-1])
return ' '.join(l)
#将字符串中以空格为分隔符加入到列表l中
#再将l中元素以空格为分隔符连接成新的字符串,否则返回的是列表
class Solution:
def reverseWord(self , str: str) -> str:
# write code here
l=[]
for i in str.split(' '):
l.append(i[::-1])
return ' '.join(l)