Aaron Brady <castironpi at gmail.com> writes: > url+= { '/': '' }.get( url[ -1 ], '/' ) > > Shorter is always better. url = url.rstrip('/') + '/'