What's the best way to slice the last word from a block of text?
I can think of
- Split it to a list (by spaces) and removing the last item, then reconcatenating the list.
- Use a regular expression to replace the last word.
I'm currently taking approach #1, but I don't know how to concatenate the list...
content = content[position-1:position+249] # Content
words = string.split(content, ' ')
words = words[len[words] -1] # Cut of the last word
Any code examples are much appreciated.
OR