How to use "/" (directory separator) in both Linux and Windows in Python?
Use:
import os
print os.sep
to see how separator looks on a current OS.
In your code you can use:
import os
path = os.path.join('folder_name', 'file_name')
You can use os.sep:
>>> import os
>>> os.sep
'/'
Use os.path.join()
.
Example: os.path.join(pathfile,"output","log.txt")
.
In your code that would be: rootTree.write(os.path.join(pathfile,"output","log.txt"))