Verify that the folder no longer exists, if it exists, it should print a message to the user indicating.
I got stuck without knowing how to check something related to this:
os.listdir()
os.mkdir (input('Insira o nome:'))
if os.path.exists ('Users\Akros\Desktop\TESTE') == True:
print ('Ja existe um arquivo com esse nome!')
else:
print ("Criado com sucesso!")
The error that appears is:
File "C:\Users\Akros\Desktop\TESTE\OS.py", line 21, in sys_calls
os.mkdir (input('Insira o nome:'))
FileExistsError: [WinError 183] Não é possível criar um arquivo já existente: 'AKROS'
I have already used os.path.isdir / os.path.isfile / os.path.lexists.
This is a requirement for an exercise I am doing at the federal institute, if you link in this case request that if a folder is created or deleted that already exists or does not exist warn the user. But I can not figure out which command or the logic of how to do this, it will not pro "print" the error message will appear.