(path)
Create a file if it doesn't exist and open for reading and writing.
Create a file if it doesn't exist and open for reading and writing.
Create a file if it doesn t exist and open for reading and writing .
def _create_carefully(path):
    """Create a file if it doesn't exist and open for reading and writing."""
    fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0o666)
    try:
        return open(path, 'rb+')
    finally:
        os.close(fd)
def _create_carefully ( path ) : fd = os . open ( path , os . O_CREAT | os . O_EXCL | os . O_RDWR , 0o666 ) try : return open ( path , 'rb+' ) finally : os . close ( fd )