Config.py 768 B

123456789101112131415161718192021222324252627282930
  1. # coding:utf8
  2. '''
  3. @Project :Scan
  4. @File :Config.py
  5. @Author :Leslie
  6. @Date :2023/5/8 16:20
  7. '''
  8. import winreg
  9. import yaml
  10. class Configuration:
  11. def getConfiguration(self):
  12. with open('setting.yml', 'r', encoding='utf-8') as f:
  13. file_content = f.read()
  14. content = yaml.load(file_content, yaml.FullLoader)
  15. a =[]
  16. a =content['materials']
  17. return a
  18. def get_desktop(self):
  19. key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
  20. r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', )
  21. return winreg.QueryValueEx(key, "Desktop")[0]
  22. if __name__ == '__main__':
  23. print(Configuration().getConfiguration())
  24. print(Configuration().get_desktop())