美文网首页Python学习历程
01 实现在网页上打印出你的名字

01 实现在网页上打印出你的名字

作者: 心际花园 | 来源:发表于2017-07-04 14:38 被阅读5次
    ##实现在网页上打印出你的名字。
    from flask import Flask
    app=Flask(__name__)
    
    @app.route('/')
    def index():
        return '<h1>Hello world!</h1>'
    
    @app.route('/user/<name>')
    def user(name):
        return '<h1>Hello ,%s!</h1>' % name
    
    if __name__=='__main__':
        app.run(debug=True)
    
    

    在浏览器上的user/后面,输入你的名字,即可在网页上显示。
    http://127.0.0.1:5000/user/

    相关文章

      网友评论

      本文标题:01 实现在网页上打印出你的名字

      本文链接:https://www.haomeiwen.com/subject/qafxhxtx.html