File size: 1,333 Bytes
551af33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "933a0a3c-9628-42c7-895b-2f64215829ee",
   "metadata": {},
   "outputs": [],
   "source": [
    "import rarfile\n",
    "\n",
    "# 指定 .rar 文件的路径\n",
    "rar_path = '/teamspace/studios/this_studio/models0719必装模型.rar'\n",
    "password = 'wx:aix0069'  # 设置密码\n",
    "\n",
    "# 打开 .rar 文件\n",
    "with rarfile.RarFile(rar_path) as rf:\n",
    "    # 设置密码\n",
    "    rf.setpassword(password)\n",
    "    \n",
    "    # 获取所有文件名列表\n",
    "    file_list = rf.namelist()\n",
    "    \n",
    "    # 打印文件名\n",
    "    for file in file_list:\n",
    "        print(file)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9a832015-426f-42a2-b651-7f5912fd54f2",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}