I have the following question:
Print a string which has the reverse order 'Python love We. Science Data love We'
所以我试了一下:
strg = We love Data Science. We love Python
words = strg.split(" ")
words.reverse()
new_strg = " ".join(words)
print(new_strg)
>>> Python love We Science. Data love We
但答案并不像预期的那样,因为Science
之后的.
并不在正确的位置.
有没有办法达到预期的效果?