# coding:utf8 ''' @Project :Scan @File :Config.py @Author :Leslie @Date :2023/5/8 16:20 ''' import winreg import yaml class Configuration: def getConfiguration(self): with open('setting.yml', 'r', encoding='utf-8') as f: file_content = f.read() content = yaml.load(file_content, yaml.FullLoader) a =[] a =content['materials'] return a def get_desktop(self): key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', ) return winreg.QueryValueEx(key, "Desktop")[0] if __name__ == '__main__': print(Configuration().getConfiguration()) print(Configuration().get_desktop())