Jean-Michel Pichavant wrote:
Aaron Brady wrote:Shorter is always better. url+= { '/': '' }.get( url[ -1 ], '/' )Why bother with spaces or 3 letter-wide token, check this :o) : x+={'/':''}.get(x[-1],'/')
Even shorter: x+='/'*(x[-1]!='/')
Apart from joking, the following proposed solution is by **far** the one I preferif not url.endswith('/'): url += '/'Maybe not the shorter, but the most concise and clear to me.
Definitely. -- http://mail.python.org/mailman/listinfo/python-list