python get file size in mb
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
You must login to ask question.
import os.path file_path = r'path where the file is stored\file name.file extension' file_size = os.path.getsize(file_path) print('File size in Bytes: ' + str(file_size)) print('File size in Kilobytes: ' + str(file_size/1024)) print('File size in Megabytes: ' + str(file_size/1024**2)) print('File size in Gigabytes: ' + str(file_size/1024**3))