If you have strings of all the CHECKEDOUT (is this from the lsco command?), then the following might work for you: >>> s ="/main/parallel_branch_1/release_branch_1.0/dbg_for_python/CHECKEDOUT from /main/parallel_branch_1/release_branch_1.0/4" >>> s.split()[0].split('/')[-2] 'dbg_for_python' >>> - Paddy.