You could split it into a list, slice it and then join it into a string again:
filePath = '/'.join( '/Volumes/Something1/Something2/Something3/Something4/Somefile.%04d.dpx'.split( '/' )[:4] ) - diogo On Tue, May 15, 2012 at 11:41 AM, Noggy <[email protected]>wrote: > ** > I'm trying to take a filePath similar to the one below and trying replace > everything after the 3rd slash. Is there a command that filters through a > string from left to write and return how many \ there are? I'm thinking of > creating a slashVar to use in a simple loop, this can tell me how far into > a path I am. If slashVar has a value of 3, that means I'm in the render > folder. I'm having trouble finding the right command that does this. > > C:\jobName\shot\render\myRenders.####.dpx > > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
