You can also use a wider pattern like :
r'(%+\d+d)|(#+)|(%d)'
to catch a few more cases. I highly recommend that you account for
these as you might run into problems later.

On Fri, Jun 10, 2011 at 8:31 AM, julien hery <[email protected]> wrote:
> great it works like a charm!
> thanks a lot
> ________________________________
> De : Brandon Harris <[email protected]>
> À : julien hery <[email protected]>; Nuke Python discussion
> <[email protected]>
> Envoyé le : Vendredi 10 Juin 2011 17h10
> Objet : Re: [Nuke-python] Detect padding in a filename
>
> import re
> result = None
> image = 'awesome.0101.exr'
> number = re.search('\.(\d+)\.', image)
> if number:
>     result = len(number.group(1))
> print result
>
> I would use regex to pull that information out.
>
> Brandon L. Harris
>
>
> On 06/10/2011 10:06 AM, julien hery wrote:
>
> Hello,
> It's more a general python question, but image related.
> I'm looking at detecting the padding of a filename let's say something like
> " Filename.001.exr" would return 3
> I'm having a hard time to find this answer on the web
> Thanks for your help
>
> _______________________________________________
> 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
>
>
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to