繁体   English   中英

Python Flask:使用带有输入参数的 GET function

[英]Python Flask: Using a GET function with an input parameter

I am quite new to flask, and have a Python Flask function that is throwing an error because of an input parameter. 谁能建议出了什么问题?

@app.route('/test', methods=['GET'])
def test_api(x):
  if (x>10):
     ans = "Yes"
  else:
     ans = "No"
  return ans

在点击 API 后,我收到错误: TypeError: test_api() missing 1 required positional argument: 'x'

'x' 作为查询参数从 URL 传递

x 应该是什么? 你能澄清一下吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM