laskuma
V2EX  ›  问与答

Python中该如何理解这句statement?

  •  
  •   laskuma · Nov 3, 2013 · 4095 views
    This topic created in 4646 days ago, the information mentioned may be changed or developed.
    在做topic modeling的research。对python不是很熟悉,正在看gensim的tutorial,有这么一句话不是很明白。能帮我分解一下吗?能否告诉我这种格式叫什么?
    texts = [[word for word in document.lower().split() if word not in stoplist]for document in documents]
    4 replies    1970-01-01 08:00:00 +08:00
    stillwater
        1
    stillwater  
       Nov 3, 2013   ❤️ 1
    list comprehension
    laskuma
        2
    laskuma  
    OP
       Nov 3, 2013
    @stillwater 感谢!
    mkeith
        3
    mkeith  
       Nov 3, 2013   ❤️ 1
    texts = []
    for document in documents:
    for word in document.lower().split():
    if word not in stoplist:
    texts.append(word)
    subpo
        4
    subpo  
       Nov 3, 2013   ❤️ 1
    好像一下子知道pythoner推崇的pythonic是什么意思了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5327 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 08:45 · PVG 16:45 · LAX 01:45 · JFK 04:45
    ♥ Do have faith in what you're doing.