This question might look silly but, I have a /tmp/size.txt
with this content:
hello
and os.path.getsize('/tmp/size.txt')
says 6
but when I do:
sys.getsizeof(b'hello')
# OR
sys.getsizeof(bytes(bytearray('hello')))
# OR
sys.getsizeof(bytes('hello'))
it returns 42
.
What is the difference between the os.path.getsize
and sys.getsizeof
?