Python源码:
def wx_path(): ## 获取当前用户名 users = os.path.expandvars('$HOMEPATH') ## 找到3ebffe94.ini配置文件 f = open(r'C:' + users + '\\AppData\\Roaming\\Tencent\\WeChat\\All Users\\config\\3ebffe94.ini') ##读取文件将路径放到wx_location变量里 if f == 'MyDocument:': wx_location = 'C:' + users + '\Documents\WeChat Files' else: wx_location = f.read() + "\WeChat Files" ## 输出路径信息 print(f"\n微信用户信息路径: \"{wx_location}\"\n") # 程序入口 if (__name__ == '__main__') or (__name__ == 'main'): wx_path();
效果:
参考:
https://www.52pojie.cn/thread-1578475-1-1.html