Reputation: 371
Is it possible to get file size info with a magic command in notebook?
I've searched the internet but couldn't find an answer.
Upvotes: 0
Views: 4977
Reputation: 71
My answer is not relative to IPython but you may use the os library in Python, it’s very simple as well. More specifically, you can get the size of a file using
import os
size_bytes = os.stat(<put_file_name_here>).st_size
Note: the result will be in bytes so you can divide by 1 000 000 if you want the result to be in MB.
Upvotes: 2