bruno at modulix wrote:
> parts = s.replace(' ', '/').strip('/').split('/')
> branch = parts[parts.index('CHECKEDOUT') - 1]
>
> Edward Elliott wrote:
>>
>> marker = s.index('/CHECKEDOUT')
>> branch = s [s.rindex('/', 0, marker) + 1 : marker]
>
> Much cleaner than mine. I shouldn't try to code when it's time to bed !-)
Not terribly readable though, hard to tell what the magic slice indexes
mean. Yours is easier to follow. I think I'd just use a regex though.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list