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"))
More Related Contents:
- How do I run Selenium in Xvfb?
- Getting MAC Address
- Python pysftp get_r from Linux works fine on Linux but not on Windows
- What is the simplest way to SSH using Python?
- Python spawn off a child subprocess, detach, and exit
- fcntl substitute on Windows
- Python: how to kill child process(es) when parent dies?
- Shebang Notation: Python Scripts on Windows and Linux?
- How to find the real user home directory using python?
- How do you set your pythonpath in an already-created virtualenv?
- Packaging a Python script on Linux into a Windows executable
- Cross-platform subprocess with hidden window
- Python virtualenv questions
- Cross-platform space remaining on volume using python
- In Python script, how do I set PYTHONPATH?
- How to make a python, command-line program autocomplete arbitrary things NOT interpreter
- Can Python select what network adapter when opening a socket?
- How to open a file with the standard application?
- How to split a huge csv file based on content of first column?
- Fetching the output of a command executed through os.system() command [duplicate]
- When using os.execlp, why `python` needs `python` as argv[0]
- Python multiprocessing linux windows difference
- Python – How to check if a file is used by another application?
- Dropping Root Permissions In Python
- How to find the mountpoint a file resides on?
- How do I get all of the output from my .exe using subprocess and Popen?
- Memory error when using pandas read_csv
- Unable to install pyodbc on Linux
- Get window position & size with python
- Silent printing of a PDF in Python