flipping string order

Denis McMahon denismfmcmahon at gmail.com
Sun Jul 19 20:06:25 CEST 2015


On Sun, 19 Jul 2015 17:35:03 +0100, MRAB wrote:

> rsplit -> one line.

def lastWordFirst(s):
    return " ".join(reversed(s.rsplit(" ", 1)))

-- 
Denis McMahon, denismfmcmahon at gmail.com


More information about the Python-list mailing list