Writing to a new file if it doesn't exist, and appending to a file if it does Writing to a new file if it doesn't exist, and appending to a file if it does python-3.x python-3.x