推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
tinydebian
V2EX  ›  Python

Python compileall 如何排除 2 个子目录?

  •  
  •   tinydebian · Oct 22, 2019 · 3239 views
    This topic created in 2438 days ago, the information mentioned may be changed or developed.
    下面的命令,可以使用 python compileall,并且排除一个子目录。
    python -m compileall -x r"*/folder1*" /python-folder/

    请问,如何排除 2 个子目录呢?谢谢。
    9 replies    2019-10-22 17:31:04 +08:00
    Latin
        1
    Latin  
       Oct 22, 2019
    自己写 compile 脚本包装下
    Cooky
        3
    Cooky  
       Oct 22, 2019 via Android
    find,grep,xargs
    tinydebian
        4
    tinydebian  
    OP
       Oct 22, 2019
    @Latin 可以借用 compileall -x (regex)的吧?只是这个 regex 稍复杂点。
    tinydebian
        5
    tinydebian  
    OP
       Oct 22, 2019
    @ihidchaos 使用 compileall -x (regex) 应该是最简洁的吧?只是这个 regex 稍复杂点。
    tinydebian
        6
    tinydebian  
    OP
       Oct 22, 2019
    @Cooky 使用 compileall -x (regex) 应该是最简洁的吧?只是这个 regex 稍复杂点。
    Latin
        7
    Latin  
       Oct 22, 2019
    看来大家都是混淆成 pyc 啊 手动滑稽
    Latin
        8
    Latin  
       Oct 22, 2019   ❤️ 1
    tinydebian
        9
    tinydebian  
    OP
       Oct 22, 2019
    @Latin 是啊,compileall 就是 byte-comile => .pyc 文件的。

    有 2 个子目录,我想排除掉( skipped )。如果只是 skip 一个子目录 -x r"*/folder1*" 工作得非常好,但是我不知道怎么写这个 regex 来排除 2 个 或 3 个 子目录。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5534 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 06:33 · PVG 14:33 · LAX 23:33 · JFK 02:33
    ♥ Do have faith in what you're doing.