I use Maya to render my cartoon, and got a problem when I programming with python. Maya gives me an string variable which is a path, and I want to convert it to a normalized path. However, when it comes to '\b', I totally failed to play with it. Here's the problem:
I want to convert the string in paths whose value looks like 'D:\notebook\bot' to 'D/notebook/bot':
paths = ['D:\notebook\bot', 'D:\newworld']
for p in paths:
p = '{0!r}'.format(p).replace('\\', '/').replace(':','')
print p
The output is :
D/notebook/x08ot
D/newworld
See, the \n is correctly printed out as /n, however, \b is being escaped as /x08. How can I achieve what I want? Note I can't format the input paths as:
paths = [r'D:\notebook\bot', r'D:\newworld']
because it's passed from Maya. Python version is 2.6.
"D:\\notebook\\bot", "D:\\newworld"?