[Tutor] Working with bash (subversion)

Luke Paireepinart rabidpoobear at gmail.com
Thu Jul 19 00:34:24 CEST 2007


Justin Cardinal wrote:
> That fixed it, thanks! Now I just need to do some studying on working with
> lists (or whatever this output is...) so I can filter out the results I
> don't want. Here's an updated version of the program:
> ================================================================
> #!/usr/bin/env python
>  
> import commands as c
>
> lsout = c.getoutput('ls -d /home/svn/repository/*/').split('\n')
> results = []
> for row in lsout:
>   temp = c.getoutput('svnadmin lslocks ' + row).split('\n')
>   if temp != ['']:
>     results.append(temp)
>   
temp is a list, so results is going to end up being a list of lists. is 
that the desired behavior?
> print results 
> ================================================================
> ...and the output:
> ================================================================
> ['Path: /test/trunk/data.bin', 'UUID Token:
> opaquelocktoken:9ee85aae-c9dc-4388-8958-87b708e628a3', 'Owner: jcardinal',
> 'Created: 2007-07-17 14:36:18 -0500 (Tue, 17 Jul 2007)', 'Expires: ',
> 'Comment (1 line):', '', '']
> ================================================================
>
> Thanks very much to all who replied, it's amazing how quick help arrives!
>   
Well, I for one would rather answer your questions than study for a 
Differential Equations test :)
> -Justin
-Luke


More information about the Tutor mailing list