Automatically deleting pyc files when corresponding py is moved (Mercurial)

前端 未结 7 1379
庸人自扰
庸人自扰 2021-02-13 04:00

(I foresaw this problem might happen 3 months ago, and was told to be diligent to avoid it. Yesterday, I was bitten by it, hard, and now that it has cost me real money, I am kee

7条回答
  •  执念已碎
    2021-02-13 04:22

    i use this script to delete the .pyc files in the current folder, this script could be used alone or include it in the exit function to delete the .pyc files when u exit.

    import os
    files = [f for f in os.listdir('.') if os.path.isfile(f) and '.pyc' in str(f)]
    for f in files : os.unlink(os.getcwd()+'/'+f)
    

提交回复
热议问题