我需要访问问号后的句子,例如follow(我正在使用flask和python):
http://localhost:8000/answer?the new book is added
我使用以下代码:
query_string = request.query_string
我知道URL中不允许使用空格,但是有没有办法我可以再次将%20解码为空格?
答案 0 :(得分:0)
您可以为此使用python的标准库。
Python3:
import urllib.parse
urllib.parse.unquote(request.query_string)
Python2
import urllib
urllib.unquote(request.query_string)