To find the size of a JSON file in Python, you can use the following code:
main.py143 chars7 lines
Here, we are using the os.path.getsize()
function to get the size of the file, in bytes. We pass the file path as an argument to this function. Finally, we print out the size of the file, along with the filename.
gistlibby LogSnag