I have the following string:
apple.开发者_开发问答orange.red.green.yellow
How can i reverse it to get the following:
yellow.green.red.orange.apple
I like this (more readable?) one:
>> s = "yellow.green.red.orange.apple"
>> '.'.join(reversed(s.split('.')))
'apple.orange.red.green.yellow'
'.'.join(s.split('.')[::-1])
精彩评论