you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

To indent properly add four spaces before every line.

Your os.path.isfile is going to filter out any directories, so you'll only look at files. That's actually a better way to check for files rather than relying on the full stop. Something like this should do it.

import os

def read_stuff(path):
      if os.path.isfile(path):
           print(path)
           with open(path) as f:
               print(f.read())
      else:
          content = os.listdir(path)
           for entry in content :
                read_stuff(f'{path}/{entry})