Posts

How to read encrypted Wheel and Pickle File in python


import zipfile

# Specify the path to your wheel file
wheel_file_path = 'test_opthyptuning_optimization-0.1-py3-none-any.whl'

# Open the wheel file as a zip archive
with zipfile.ZipFile(wheel_file_path, 'r') as wheel:
    # List all files in the wheel
    wheel_contents = wheel.namelist()
    
    for file in wheel_contents:
        print("Found file", file)  # Print the name of each file
        
        # Check if the file is the one you want to read
        if file == "test_opthyptuning_optimization-0.1.dist-info/METADATA":
            with wheel.open(file) as f:  # Use wheel.open() to read the file
                # Read and print the content of the file
                content = f.read().decode('utf-8')  # Decode bytes to string
                print(content)  # Print the content of the file
How to read Pickle File in Python

import pickle

# Specify the path to your .pkl file
pkl_file_path = '/projects/challenge/.ans/ans7c.pckl'  # Replace with your file path

# Read the .pkl file
with open(pkl_file_path, 'rb') as file:
    data = pickle.load(file)

# Output the loaded data
print(data)

# expected = ['0f793a67ed94aff67f1e061518316fb6', '868a34bb668fee546f41fbef5c6bec45', 'a75c799970a727c3c81af4e84d764b5f']

obj = str("momentum: 0.17").encode()  # 6767.67
m = hashlib.md5()
m.update(bytes(obj))
m.hexdigest()



# expected = ['0f793a67ed94aff67f1e061518316fb6', '868a34bb668fee546f41fbef5c6bec45', 'a75c799970a727c3c81af4e84d764b5f']

obj = str("rmsProp: 0.19").encode()  # 6767.67
m = hashlib.md5()
m.update(bytes(obj))
m.hexdigest()



# expected = ['0f793a67ed94aff67f1e061518316fb6', '868a34bb668fee546f41fbef5c6bec45', 'a75c799970a727c3c81af4e84d764b5f']

obj = str("adam: 0.17").encode()  # 6767.67
m = hashlib.md5()
m.update(bytes(obj))
m.hexdigest()

About the author

D Shwari
I'm a professor at National University's Department of Computer Science. My main streams are data science and data analysis. Project management for many computer science-related sectors. Next working project on Al with deep Learning.....

Post a Comment