• 请不要在回答技术问题时复制粘贴 AI 生成的内容
ithelloworld
V2EX  ›  程序员

如何查找python代码中所有未使用到的from与import的类库

  •  
  •   ithelloworld · Apr 2, 2013 · 4400 views
    This topic created in 4803 days ago, the information mentioned may be changed or developed.
    例:

    from a import b

    # 下面的操作没用到b

    如何找出所有这种情况?
    14 replies    1970-01-01 08:00:00 +08:00
    phuslu
        1
    phuslu  
       Apr 2, 2013   ❤️ 1
    我用的 SublimeLinter,它会实时标注。
    tokki
        2
    tokki  
       Apr 2, 2013 via Android
    装个语法检测的
    ithelloworld
        3
    ithelloworld  
    OP
       Apr 2, 2013
    @phuslu 用Vim呢?
    @tokki 装啥呢?
    tokki
        4
    tokki  
       Apr 2, 2013 via Android   ❤️ 1
    @ithelloworld 用Vim 等我开电脑 我怕打错名字
    nkliwenjian
        5
    nkliwenjian  
       Apr 2, 2013   ❤️ 1
    话说如果不是极度排斥的话,为什么不同时装几个开发工具呢,这东西又没冲突。我现在是用sublime写代码,用aptana来调试。遇到需要import什么东西的时候,我都是直接跑aptana底下来个ctrl+shift+o完事。
    ritksm
        6
    ritksm  
       Apr 2, 2013   ❤️ 1
    PyCharm...
    pylint应该也可以检测到吧....
    tokki
        7
    tokki  
       Apr 2, 2013
    pip install flake8 这个就可以了

    你也可以看下我的vimrc

    https://github.com/tokki/vimrc/blob/master/vimrc
    ithelloworld
        8
    ithelloworld  
    OP
       Apr 2, 2013
    @tokki 这个好,谢谢!
    tokki
        9
    tokki  
       Apr 2, 2013
    请上传一个头像-。-
    clino
        10
    clino  
       Apr 2, 2013   ❤️ 2
    ulipad也有这个功能,写代码的时候就能提示了
    guoqiao
        11
    guoqiao  
       Apr 2, 2013   ❤️ 1
    @ithelloworld vim + pyflakes
    0bit
        12
    0bit  
       Apr 2, 2013   ❤️ 1
    pycharm 真的很贴心……
    TankyWoo
        13
    TankyWoo  
       Apr 2, 2013
    pyflakes,以前在博客上小记了一笔 http://www.wutianqi.com/?p=3404
    yuelang85
        14
    yuelang85  
       Apr 2, 2013
    搜索b,不行?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   975 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 20:00 · PVG 04:00 · LAX 13:00 · JFK 16:00
    ♥ Do have faith in what you're doing.