pyc convert to py file

# -*- coding: utf-8 -*-
# requirements: pip install uncompyle6

from os.path import splitext, isdir
from os import listdir, system, mkdir

if __name__ == '__main__':

    if system('uncompyle6 -h > NUL') != 0:
        print('No requirements to do: pip install uncompyle6')
        raise SystemExit(-1)

    if not isdir('convert_py'):
        mkdir('convert_py')
    for e in listdir('.'):
        file = splitext(e)[0]
        extesion = splitext(e)[1]
        if extesion == '.pyc':
            system('uncompyle6 {0} > .\\convert_py\\{1}.py'.format(e, file))

猜你喜欢

转载自blog.csdn.net/kang666888777/article/details/88524560
今日推荐