151. Reverse words in a string

Topic description:

 Code 1:

class Solution(object):
    def reverseWords(self, s):
        """
        :type s: str
        :rtype: str
        """
        s=s.strip()
        my_list=s.split()
        my_list=my_list[::-1]
        return ' '.join(my_list)

Guess you like

Origin blog.csdn.net/qq_39031009/article/details/130487591