def find_max(lst):
if not lst:
return None
max_value = lst[0]
for num in lst:
if num > max_value:
max_value = num
return max_value
def get_file_size(file_path):
return os.path.getsize(file_path)
def get_directory_size(directory):
total_size = 0
for dirpath, dirnames, filenames in os.walk(directory):
for f in filenames:
fp = os.path.join(dirpath, f)
if os.path.exists(fp):
total_size += os.path.getsize(fp)
return total_size
def get_absolute_path(path):
return os.path.abspath(path)
import os
def get_current_directory():
return os.getcwd()
def create_directory(path):
if not os.path.exists(path):
os.makedirs(path)