The current directory contains lots of *.pyc file. List all of file has extension pyc.
Hint:
os.listdir(folder_path)
return all file in folder path
In [6]:
import os
os.listdir('.')
Out[6]:
In [5]:
import os
[fname for fname in os.listdir('.') if fname.endswith('.pyc')]
Out[5]:
Remove all *.pyc file
Hint:
In [ ]:
[os.remove(fname) for fname in os.listdir('.') if fname.endswith('.pyc')]
In [ ]: