Module backend.scraper.libs.lib_helper
Helper class for various utility functions.
Methods
init: Initialize the Helper object. del: Destructor for the Helper object. file_to_dict: Read a JSON file and return its contents as a dictionary.
Classes
class Helper-
Initialize the Helper object.
Expand source code
class Helper: def __init__(self): """ Initialize the Helper object. """ self = self def __del__(self): """ Destructor for the Helper object. """ print('Helper object destroyed') def file_to_dict(self, path): """ Read a JSON file and return its contents as a dictionary. Args: path (str): Path to the JSON file. Returns: dict: Dictionary containing the contents of the JSON file. """ f = open(path, encoding="utf-8") dict = json.load(f) f.close() return dictMethods
def file_to_dict(self, path)-
Read a JSON file and return its contents as a dictionary.
Args
path:str- Path to the JSON file.
Returns
dict- Dictionary containing the contents of the JSON file.