0
How the size of a file is calculated using python?
Doubt
3 Respostas
+ 9
ok - would be interesting to see how your logic does work. Can you share your knowledge with us? What are your doubts on using os methods?
otherwise it can be done like this:
You can use os module:
import os
f_size = os.path.getsize(my_path)
make sure that the file path "my_path" is written correctly according to the operating system you are working with. "my_path" has to contain the path and the file name, separated with the separators according to the operating system you are using.
It is recommended to do the handling of path information by using module pathlib.
+ 3
You can use "os path" module or stat function.
0
I don't want to use function i want to make it by logic