Avatar ·

Is it possible to initialize class variables from a dictionary. Python3.8

📁 dictionary, Advanced Python Topics, example, AI

Is there a way to assign values from a dictionary to each class variable? For example, a class has variables: A, B, C, D, and I pass a dictionary to the class constructor:

dictionary = {'B': 5, 'A': 2, 'C': 45}

The constructor should access the class variables by the dictionary key names and assign them these values, while the keys can be in any order.

Example class:

class Example:    def __init__(self, d:                    
Avatar ·

In the new version of Windows 10 (1903), developers placed stubs python.exe, python3.exe, etc. in the folder %USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps. When accessing these stubs, the Microsoft Store opens.

The path to this folder is specified almost at the beginning of the user's PATH variable and is added to the system PATH. If you add a new path to the python.exe file in the system PATH, this will help solve the problem, although difficulties may arise when switching users if the installation was performed in a local folder. In this case, it is preferable to place the new path at the beginning of the user PATH, rather than at the end, as often happens.

PS. Scre

Log in to leave an answer

Blogs