How to Create a file at a specific path in python?
Question: I am writing below code which is not working:

    
    
    cwd = os.getcwd()
    print (cwd)
    log = path.join(cwd,'log.out')
    os.chdir(cwd) and  Path(log.out).touch() and os.chmod(log.out, 777)
    

how can I create a log.out into cwd ?


Answer: you can call the usual linux `touch` command via `subprocess`

    
    
    import subprocess
    subprocess.call(["touch", cwd+"/log.out"])
    

