推荐学习书目
› 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
heziliang
V2EX  ›  Python

Python 匹配黑名单关键词?

  •  
  •   heziliang ·
    hzlRises · Jul 31, 2017 · 4029 views
    This topic created in 3383 days ago, the information mentioned may be changed or developed.
    文件 A 有 100 个正常关键词,一行一个(正常关键词,每个关键词字符较长)
    文件 B 有 5 个关键词,一行一个(黑名单词根,每个关键词字符较短)
    用 Python
    如果 A 中的某个关键词含有 B 中的任何一个词根,则将该关键词保存在文件 C
    如果 A 中的某个关键词不含 B 中的任何一个词根,则将该关键词保存在文件 D
    6 replies  •  2017-08-01 11:45:26 +08:00
    techmoe
    techmoe
    Aug 1, 2017 via Android
    1
    所以说你想问什么?
    mskip
    mskip
    Aug 1, 2017
    2
    伸手党
    heziliang
    heziliang
    OP
    Aug 1, 2017
    3
    @mskip 不是伸手党,谢谢,如果 A 中的某个关键词含有 B 中的任何一个词根,则将该关键词保存在文件 C,这个条件能写出来。。
    如果 A 中的某个关键词不含 B 中的任何一个词根,则将该关键词保存在文件 D,这个条件该怎么写?
    heziliang
    heziliang
    OP
    Aug 1, 2017
    4
    @techmoe 请问,如果 A 中的某个关键词不含 B 中的任何一个词根,则将该关键词保存在文件 D
    这个逻辑要怎么实现
    CryMeatel
    CryMeatel
    Aug 1, 2017
    5
    …… LZ 是完全没编过程么
    wlsnx
    wlsnx
    Aug 1, 2017
    6
    给你个提示:if else
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2672 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:13 · PVG 21:13 · LAX 05:13 · JFK 08:13
    ♥ Do have faith in what you're doing.