I’m trying to create a directory if the path doesn’t exist, but the ! (not) operator doesn’t work. I’m not sure how to negate in Python… What’s the correct way to do this?

if (!os.path.exists("/usr/share/sounds/blues")):
        proc = subprocess.Popen(["mkdir", "/usr/share/sounds/blues"])
        proc.wait()

4 Answers
4

Leave a Reply

Your email address will not be published. Required fields are marked *