1harshit234 / file-handling

0 stars 0 forks source link

os path #1

Open 1harshit234 opened 2 weeks ago

1harshit234 commented 2 weeks ago

how to open and check the exietence of the file by the help of the op path , path lib os.path.isfile('file_path'): Returns True if the path is a regular file. os.path.exists('file_path'): Returns True if the path is a file, directory, or a valid symlink. os.path.isdir('file_path')

1harshit234 commented 2 weeks ago

os.path.getsize('file_path'): Return the file size in bytes. os.stat(file).st_size: Return the file size in bytes Pathlib module:

pathlib.Path('path').stat().st_size: Return the file size in bytes.

1harshit234 commented 2 weeks ago

https://pynative.com/python/file-handling/

isske sare importnat files