Home  >  Q&A  >  body text

sublime-text - sublime text 3中编译python(sublimeREPL),如何仅运行单行/选定部分

在ST3中编译python时,默认是运行整个.py文件,可否只运行单行代码或选定的部分?

PHP中文网PHP中文网2741 days ago622

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-18 10:33:23

    Python is an analytical language.

    Python unit testing should be on your mind.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:33:23

    Put the selected part into a function, and then call it inside the main function

    def foo():
        print 'I was selected'
    
    def main():
        foo()
    
    if __name__ == "__main__":
        main()
    

    reply
    0
  • Cancelreply