hello , for get rid of ".nk" you can use re module.
import reyourText= "01_sweetTree_v001.nk"remove = ".nk"rep = 
""a=re.sub(remove,rep,yourText)print a
if you want to replace ".nk" by an other string you just have to enter a string 
in rep.Mat.


From: [email protected]
Date: Thu, 31 May 2012 16:08:47 +0100
To: [email protected]
Subject: [Nuke-python] Re: Seeing inside a string, to replace a file path








        
        Few more questions on this topic.



I got my path split now into a list using;  wPath.split('/')[:2]

That returns a list; ['C:', 'shotFolder']

How do I add another item to the list?  I try just += a string variable but 
each character is treated as a string in the list giving me; ['C:', 
'shotFolder', 'r', 'e', 'n', 'd', 'e', 'r']

There's some kind of concatenation syntax I'm missing.





Also, if I have a filename like "01_sweetTree_v001.nk".  What's the easiest way 
to get rid of ".nk"?  That way I'm left with just the filename, 
"01_sweetTree_v001"?
        


_______________________________________________
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