GithubHelp home page GithubHelp logo

web-dev_task1-2_hello-world's People

Contributors

simplemain avatar

Watchers

 avatar  avatar

web-dev_task1-2_hello-world's Issues

使用Python+Flask完成本周作业

from flask import Flask
from flask import request
from flask.ext.script import Manager


app = Flask(__name__)
manager = Manager(app)

@app.route('/', methods=['GET', 'POST'])
def home():
    return '<h1>Home</h1>'

@app.route('/add', methods=['GET'])
def add_form():
    return '''<form action="/add" method="post">
    <p><input name="number1"></p>
    <p><input name="number2"></p>
    <p><button type="submit">Add</p>
    </form>'''

@app.route("/add", methods=['POST'])
def add():
    result = int(request.form['number1']) + int(request.form['number2'])
    return '<h3>The result is %s.</h3>' %result

if __name__ == "__main__":
    manager.run()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.