a lot
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# coding=utf-8
|
||||
|
||||
"""
|
||||
light
|
||||
20170715
|
||||
批量修改文件名
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
class ReformFileName(object):
|
||||
def __init__(self):
|
||||
self.renames("/home/light/PycharmProjects/fetchcore/src/fetchcore/")
|
||||
|
||||
def renames(self, dire):
|
||||
if not os.path.isdir(dire):
|
||||
raise Exception("dire error")
|
||||
for item in os.listdir(dire):
|
||||
path = os.path.join(dire, item)
|
||||
if os.path.isdir(path):
|
||||
self.renames(path)
|
||||
elif os.path.isfile(path):
|
||||
res = self.rules(item)
|
||||
if res:
|
||||
self.rename(dire, item, res)
|
||||
|
||||
def rules(self, name):
|
||||
temp = re.findall(r'(.*).pyc_dis$', name)
|
||||
if temp:
|
||||
new_name = temp[0] + '.py'
|
||||
return new_name
|
||||
else:
|
||||
return False
|
||||
|
||||
def rename(self, path, name, new_name):
|
||||
if os.path.exists(os.path.join(path, new_name)):
|
||||
pass
|
||||
os.remove(os.path.join(path, name))
|
||||
# raise Exception(' %s exist' % os.path.join(path, new_name))
|
||||
else:
|
||||
os.rename(os.path.join(path, name), os.path.join(path, new_name))
|
||||
# os.rename()
|
||||
|
||||
if __name__ == "__main__":
|
||||
temp = ReformFileName()
|
||||
@@ -0,0 +1,21 @@
|
||||
# pyc 反编译
|
||||
|
||||
- 环境: ubuntun14.04
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
sudo pip install uncompyle2
|
||||
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
``` bash
|
||||
# 单独反编译某文件
|
||||
uncompyle2 -o /***/***.py /***/***.pyc
|
||||
|
||||
# 批量反编译文件
|
||||
uncompyle2 -ro /***/ /***/
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user