在Web上获取Python脚本输出的最简单方法是什么? [英] What's easiest way to get Python script output on the web?

查看:333
本文介绍了在Web上获取Python脚本输出的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连续运行的python脚本。它每30秒输出2行信息。我希望能够在网上查看此输出。特别是,我希望网站能够自动更新(每30秒在页面/网站顶部添加新输出,而不必刷新页面)。

I have a python script that runs continuously. It outputs 2 lines of info every 30 seconds. I'd like to be able to view this output on the web. In particular, I'd like the site to auto-update (add the new output at the top of the page/site every 30 seconds without having to refresh the page).

我知道我可以用javascript做到这一点但是有一个基于python的解决方案吗?即使有,是javascript的方式去?如果需要,我非常愿意学习javascript,但如果没有,我想继续专注于python。

I understand I can do this with javascript but is there a python only based solution? Even if there is, is javascript the way to go? I'm more than willing to learn javascript if needed but if not, I'd like to stay focused on python.

对不起基本问题但是我还是在网络编程方面毫无头绪。

Sorry for the basic question but I'm still clueless when it comes to web programming.

Thx!

推荐答案

这个问题似乎有两件事。

This question appears to have two things in it.


  1. 在网上发表演讲。这在Python中很容易实现 - 使用Django或TurboGears或任何基于Python的Web框架。

  1. Presentation on the web. This is easy to do in Python -- use Django or TurboGears or any Python-based web framework.

刷新网页以显示新数据。这可以通过两种方式完成。

Refresh of the web page to show new data. This can be done two ways.


  • 要刷新一些奇特的Javascript。

  • Some fancy Javascript to refresh.

一些花哨的HTML来刷新页面。您想要的是元刷新标记。如果你这样做,你有一个全Python解决方案。

Some fancy HTML to refresh the page. The meta refresh tag is what you want. If you do this, you have an all-Python solution.

这篇关于在Web上获取Python脚本输出的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆