Python'daki olumsuzlama operatörü not. Bu nedenle Tıpkı yerini !ile not.
Örneğin, şunu yapın:
if not os.path.exists("/usr/share/sounds/blues") :
proc = subprocess.Popen(["mkdir", "/usr/share/sounds/blues"])
proc.wait()
Özel örneğiniz için (Neil'in yorumlarda söylediği gibi), subprocessmodülü kullanmak zorunda değilsiniz os.mkdir(), ek istisna işleme iyiliği ekleyerek ihtiyacınız olan sonucu elde etmek için kullanabilirsiniz .
Misal:
blues_sounds_path = "/usr/share/sounds/blues"
if not os.path.exists(blues_sounds_path):
try:
os.mkdir(blues_sounds_path)
except OSError:
# Handle the case where the directory could not be created.
os.mkdir()?