Python regex with question mark literal

前端 未结 5 1260
耶瑟儿~
耶瑟儿~ 2020-12-06 17:30

I\'m using Django\'s URLconf, the URL I will receive is /?code=authenticationcode
I want to match the URL using r\'^\\?code=(?P.*)$\'

5条回答
  •  庸人自扰
    2020-12-06 17:44

    You are not allowed to use ? in a URL as a variable value. The ? indicates that there are variables coming in.

    Like: http://www.example.com?variable=1&another_variable=2

    Replace it or escape it. Here's some nice documentation.

提交回复
热议问题