V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
laskuma
V2EX  ›  问与答

Python中该如何理解这句statement?

  •  
  •   laskuma · 2013-11-03 12:52:32 +08:00 · 3139 次点击
    这是一个创建于 3825 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在做topic modeling的research。对python不是很熟悉,正在看gensim的tutorial,有这么一句话不是很明白。能帮我分解一下吗?能否告诉我这种格式叫什么?
    texts = [[word for word in document.lower().split() if word not in stoplist]for document in documents]
    4 条回复    1970-01-01 08:00:00 +08:00
    stillwater
        1
    stillwater  
       2013-11-03 13:04:54 +08:00   ❤️ 1
    list comprehension
    laskuma
        2
    laskuma  
    OP
       2013-11-03 13:10:21 +08:00
    @stillwater 感谢!
    mkeith
        3
    mkeith  
       2013-11-03 13:41:32 +08:00   ❤️ 1
    texts = []
    for document in documents:
    for word in document.lower().split():
    if word not in stoplist:
    texts.append(word)
    subpo
        4
    subpo  
       2013-11-03 13:47:40 +08:00   ❤️ 1
    好像一下子知道pythoner推崇的pythonic是什么意思了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3193 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 14:41 · PVG 22:41 · LAX 07:41 · JFK 10:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.