Update page 'Day 9 homework - Sloetjes'
@@ -18,14 +18,7 @@ def get_module_size(module_name):
|
|||||||
|
|
||||||
2. Create another function that uses the last function to see how many bytes are in all the modules listed in sys.modules.
|
2. Create another function that uses the last function to see how many bytes are in all the modules listed in sys.modules.
|
||||||
```
|
```
|
||||||
import sys
|
|
||||||
|
|
||||||
def get_total_module_size():
|
|
||||||
"""Returns the total size of all loaded modules."""
|
|
||||||
total_size = 0
|
|
||||||
for module_name in sys.modules:
|
|
||||||
total_size += get_module_size(module_name)
|
|
||||||
return total_size
|
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Run your Python interpreter like you would normally, using Jupyter, and run the last function. How many bytes are being used?
|
3. Run your Python interpreter like you would normally, using Jupyter, and run the last function. How many bytes are being used?
|
||||||
|
|||||||
Reference in New Issue
Block a user