Skip to content

Instantly share code, notes, and snippets.

@napsternxg
Created October 7, 2012 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save napsternxg/3849580 to your computer and use it in GitHub Desktop.
Save napsternxg/3849580 to your computer and use it in GitHub Desktop.
Reverse the order of all the words in a given string
str = "This is a beautiful world"
" ".join(reversed(str.split(" ")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment