More Routes
@app.get('/hello/<name>')
def hello(name):
return f'Hello, {name}!'
Visit http://127.0.0.1:5000/hello/Zhi --> shows "Hello, Zhi!"
@app.get('/square/<int:n>')
def square(n):
return f'{n} squared is {n ** 2}'
Visit http://127.0.0.1:5000/square/7 --> shows "7 squared is 49"
<name> and <int:n> capture parts of the URL as function arguments.