win32netdemo.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:CodeReader 作者: jasonrbr 项目源码 文件源码
def SetInfo(userName=None):
    "Attempts to change the current users comment, then set it back"
    if userName is None: userName=win32api.GetUserName()
    oldData = win32net.NetUserGetInfo(server, userName, 3)
    try:
        d = oldData.copy()
        d["usr_comment"] = "Test comment"
        win32net.NetUserSetInfo(server, userName, 3, d)
        new = win32net.NetUserGetInfo(server, userName, 3)['usr_comment']
        if  str(new) != "Test comment":
            raise RuntimeError("Could not read the same comment back - got %s" % new)
        print("Changed the data for the user")
    finally:
        win32net.NetUserSetInfo(server, userName, 3, oldData)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号