Created
May 7, 2021 13:04
-
-
Save PranjalDureja0002/889e8b5fb6681387660dc097eadb831e to your computer and use it in GitHub Desktop.
model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_file_size(file_path): | |
| size = os.path.getsize(file_path) | |
| return size | |
| def convert_bytes(size, unit=None): | |
| if unit == "KB": | |
| return print('File size: ' + str(round(size / 1024, 3)) + ' Kilobytes') | |
| elif unit == "MB": | |
| return print('File size: ' + str(round(size / (1024 * 1024), 3)) + ' Megabytes') | |
| else: | |
| return print('File size: ' + str(size) + ' bytes') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment