I'm attempting to write a program that retrieves the file name, absolute path, etc., from a file path. Is there a module I can use in order to do that? Here's a snippet of my code
import os
filepath = "home/Documents/example.py"
print("File Name: " + os.path.basename(filepath))
print("File Path: " + os.path.abspath(filepath))
print("inode: " + os.DirEntry.inode(filepath))
I looked up a few sites and videos for this but haven't found a satisfying answer. The error I get from trying that is
TypeError: descriptor 'inode' for 'posix.DirEntry' objects doesn't apply to a 'str' object