Python
pythonimport os
import re
def all_path(dirname):
result = []
for maindir, subdir, file_name_list in os.walk(dirname):
for filename in file_name_list:
apath = os.path.join(maindir, filename)
result.append(apath)
return result
result = []
for name in all_path("."):
if name.endswith(".c") or name.endswith(".h"):
singleTxt = open(name, "r").readlines()
for k, line in enumerate(singleTxt):
singleTxt[k] = re.sub("//[\s\S]*(?=[\n])", "", singleTxt[k])
singleTxt[k] = re.sub("^[\s]*\n$", "", singleTxt[k])
singleTxt_join = "".join(singleTxt)
singleTxt_join = re.sub("/\*{1,2}[\s\S]*?\*/", "", singleTxt_join)
open("temp.txt", "w").write(singleTxt_join)
singleTxt = open("temp.txt", "r").readlines()
result.append("/**\n")
result.append(" * Copyright 2021-2021 Beijing Grant Technology Co., Ltd.\n")
result.append("*/\n")
result.append(f"/*{str(name)}*/\n")
result.extend(singleTxt)
open("result.txt", "w").writelines(result)
打包:
pip install pyinstaller
打包方法:
pyinstaller -F setup.py 打包exe pyinstaller -F -w setup.py 不带控制台的打包 pyinstaller -F -i xx.ico setup.py 打包指定exe图标打包
本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!