0

I've written a small piece of code to get the number of files in a directory. I installed the path module as well, but still i'm getting the error :

ImportError: cannot import name 'path' while running the code.

Code:

root@Anon:# cat cleanup.py 
#!/usr/bin/python3


from path import path
d=('/home/us3r/sample/')
num_files=len(d.files())
print(num_files)

I'm executing the code from the Linux terminal as below:

./cleanup.py

Thanks in Advance!!!

User123
  • 1,498
  • 2
  • 12
  • 26

0 Answers0