I'm using a tutorial from Python's web application framework, Bottle, but it's stuck in the Dynamic Routing filter.
Specifically, execute the following code:
Then, when you access
http://localhost:8080/object/192 from your browser:
If you look at Python's official document,
isinstance() returns True or False as a return value, so I think it is correct to print True. Is
192 object correct?If not, I would appreciate it if you could point out any errors in the code provided.
Thank you for your cooperation.python bottle
@route('/object/<id:int>'), the previously described
user_api function is called.
You can remove
@route('/<action>/>user>') or write this
user_api function after the
assert returns an error only if it is an error.
If you want to return True, False, you must return a string such as
return str(isinstance(id, int)) to see it correctly.
© 2022 OneMinuteCode. All rights reserved.