felix 4 years ago
commit
bd12ab9733
1 changed files with 28 additions and 0 deletions
  1. 28 0
      frog.py

+ 28 - 0
frog.py

@@ -0,0 +1,28 @@
+from flask import Flask
+app=Flask(__name__)
+
+@app.route('/')
+def index():
+    return '<h1>hello world!</h1>'
+
+@app.route('/hello/<name>')
+def hello(name):
+    return '<h1>hello '+name+'!</h1>'
+
+
+@app.route('/book/<string:name>')
+def book(name):
+    return '<h1>I like book 《%s》!</h1>'% name
+
+@app.route('/<int:num1>/plus/<int:num2>')
+def plus(num1,num2):
+    return '<h1>%s+%s=%s</h1>'%(num1,num2,num1+num2)
+
+@app.route('/height/<float:num>/m')
+def height(num):
+    cm=num*100
+    return 'My height is %s cm!' % cm
+
+@app.route('/location/<path:location>')
+def whereami(location):
+    return 'Your location is %s .' % location