1.import web
pip install web.py==0.40.dev0
下载好后,修改
将第526行的
yield next(seq)1
修改为
try: yield next(seq) except StopIteration: return
2.建一个启动py
import web urls = ( ‘/(.*)‘, ‘hello‘ ) app = web.application(urls, globals()) class hello: def GET(self, name): return open(r‘test.html‘,‘r‘).read() if __name__ == "__main__": app.run()
3.写一个页面
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Run test</title> </head> <body> <h1>hello</h1> <div> World </div> <p class="py"> python </p> <label id="l1"> test </label> <div> <a href="javascript:void(0);" onclick=‘javascript:show_text("l1","my first Javascript");‘>My First Javascript</a> <a href="javascript:void(0);" onclick=‘javascript:show_text("l1","Hello Python");‘>Hello Python</a> <a href="javascript:void(0);" onclick=‘javascript:show_color("l1","#f00") ‘>red</a> <a href="javascript:void(0);" onclick=‘javascript:show_color("l1","#0f0") ‘>green</a> </div> </body> </html>
4.运行文件
原文地址:https://www.cnblogs.com/seven7777/p/12093211.html
时间: 2024-10-11 01:13:57