Python create file if not exists else append. Checking to see if the key exists seems too ugly.

Python create file if not exists else append. I've written a for loop to 1.