Skip to main content

registry edit (注册表操作)

Project description

pyregedit

  • 该项目用于操作注册表,读写注册表的键和值
  • 兼容windows 64位和32位
  • 代码在python2.7开发和测试,兼容python3。欢迎下载并测试
  • 博客地址:http://yshblog.com/blog/132

使用方法:

  1. 需要安装pywin32: pip install pywin32
  2. 把pyregedit加入你的项目中
  3. 代码示例
    #coding:utf-8
    import pyregedit
    
    root = pyregedit.HKEY_LOCAL_MACHINE
    path = r"SOFTWARE\Microsoft\test"
    reg = pyregedit.RegEdit(root, path)
    
    #判断键是否存在
    if reg.check_key():
        #获取键(可用于其他操作)
        key = reg.get_key()
    else:
        #创建键
        key = reg.create_key()
    
    #创建值
    reg.create_value('test_name', pyregedit.REG_SZ, 'this is a test code')
    
    #创建子键
    reg.create_sub_key('sub_test')
    
    #获取子键名称列表
    print(list(reg.get_sub_keys()))
    
    #获取全部值
    print(list(reg.get_values()))
    
    #根据具体名称获取某个值的数据
    print(reg.get_value('test_name'))
    
    #删除值
    reg.delete_value('test_name')
    
    #删除子键
    reg.delete_sub_key('sub_test')
    
    #删除当前键
    reg.delete_current_key()
    

贡献者

感谢hrpzcf的贡献!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyregedit-1.0.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file pyregedit-1.0.0.tar.gz.

File metadata

  • Download URL: pyregedit-1.0.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.4

File hashes

Hashes for pyregedit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5960cfb230122d6c4c9eb5d5f22f839d38afe8c542a9e460cd1b0b85d0c479e9
MD5 848a394ad4b1417bff80fad489babca1
BLAKE2b-256 338affd635c9a1ee87a7ab06a2b6ede5881dee49fae33b995a373331ce6a18fa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page