Thinking Pythonically (was Re: gah! I hate the new string syntax)

Carel Fellinger cfelling at iae.nl
Fri Mar 2 19:12:50 EST 2001


Mark Pilgrim <f8dy at yahoo.com> wrote:
...
>>>> output = os.popen("cleartool lsvob -l").readlines()
...
>>>> [line for line in output if line[:4]=='Tag:']
...
>>>> vobs = [line.replace('Tag:', '').strip() for line in output if
> line[:4]=='Tag:']
...
>>>> "cleartool lock %s" % " ".join(vobs)
> 'cleartool lock /vobs/intranet /vobs/project'

> And that's what I call thinking Pythonically.  YMMV.

nai, that's unix thinking, like with

$ cleartool lock `cleartool lsvob -l | grep ^Tag: data | cut -c 6-`



-- 
groetjes, carel



More information about the Python-list mailing list