Hi Howard 

This is off-topic for the Nuke-Python list, but I'll give you a quick tip as 
something seems to be confusing you here! 



A 'rawstring' is a Python syntax concept only, that is: 


r'foobar\n' 


and 


'foobar\\n' 


are exactly equivalent objects once they have been parsed by Python. They're 
both str objects with the same content (or unicode in Python 3). 


Maybe that's enough to help you out, but if not, tr y asking your this and 
future non-Nuke related Python questions on http://stackoverflow.com/ 


Good luck! 


----- Original Message -----

From: "Howard Jones" <[email protected]> 
To: "Nuke Python discussion" <[email protected]> 
Sent: Tuesday, 10 July, 2012 1:59:26 PM 
Subject: [Nuke-python] dealing with mixed slashes 



Hi 


I'm ending up with a mixed path of forward and backward slashes as I am using 
Nuke 
to load a path then os.walk to return the extra paths. 


So I can comment these out with replace.('\\','\\\\') or make forward slashes, 
but only if I can convert the list to a rawstring. 


The question is how do I get a list to a rawstring 


ie 
a=['C:\2\3\a\t'] 


and I either want to make it 
['C:/2/3/a/t'] or ['C:\\2\\3\\a\\t'] 


so how do I get a=r" ['C:\2\3\a\t']" 


I cant hard code this as its os.walk returning the back slashes - unless 
there's some option there I'm missing 
(cant find anything in os.path yet either) 



Thanks 

Howard 

_______________________________________________ 
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