4
Check if the folder no longer exists, if it exists, you should print a message to the user indicating.
I got stuck not knowing how to check on 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’ve used.path.isdir / os.path.isfile / os.path.lexists .
This is an application for an exercise I’m doing at the federal institute, in case http://charles.garrocho.com/SO2016/documentos/trabalho_pratico_1_so.pdf in the case of this requirement it asks that if it is created or deleted a folder that already exists or does not exist to warn the user. But I can’t figure out which command or the logic of how to run it, it won’t go pro " print " error message appears.
What version of your python? in python2.x
input
requires a numeric type entry, to insert text must be theraw_input
– Brumazzi DB
At the institute they recommend us to use python 3.5 I never used python 2
– Akros