1
This program aims to show certain type of file you have in a folder. But it is giving the following:
erro: WindowsError: [Error 2] O sistema não pode encontrar o arquivo especificado: 'pythonteste'.
Could someone help me solve this problem ?
import os
import glob
current_directory= os.path.dirname(os.path.abspath(__file__))
os.chdir('pythonteste')
files= glob.glob('*.txt')
for file in files:
print(file)
Check if the directory
pythonteste
exists in the folder where you are running the project, or pass the absolute path to the folder that has the files you want. Obs: in this codecurrent_directory
is not being necessary.– Brumazzi DB
The party was not in the project directory, now it worked ! Thank you very much
– Igor Bastos