作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Tornado 编写一些Python代码。这是我的代码。
import sys
import tornado.ioloop
import tornado.web
import constants
class student():
name = ""
class MainHandler(tornado.web.RequestHandler):
def get(self):
loader = tornado.template.Loader(".")
print "MainiiiHandler"
self.write(loader.load("base.html").generate(pics=constants.pics))
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
因此,当我访问 127.0.0.1:8888
时,它应该在终端中打印 MainiiiHandler
。当我使用“python test.py”运行 python 代码时,结果实际上是这样的。但是当我在 vim 中使用 :make
运行时,它不会打印 MainiiiHandler
。因为我非常喜欢vim中的make功能,所以你能帮我解决这个问题吗?
最佳答案
检查如何
makeprg is python %
已写入。
:set makeprg="python %"
对我不起作用(回显空字符串)同时
:set makeprg=python\ %
确实有效。
(如果没有帮助)这就是 :h make 显示的内容:
The program given with the 'makeprg' option is started (default "make") with the optional [arguments] and the output is saved in the errorfile (for Unix it is also echoed on the screen).
如果你的系统不是 Unix,我想你必须提供为你打印错误文件内容的代码(不确定,因为我只在 Linux 下测试过)。
关于python - 为什么 vim 在运行 Python 代码时不在控制台中打印任何内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11356446/
我是一名优秀的程序员,十分优秀!