对于 uri http://foo.com/apple/123
我想得到'123'。
根据 GAE 文档,我可以使用 self.request.get() 获取 uri,但是是否有仅获取 uri 部分的助手?
请您参考如下方法:
Yes there is - the urlparse module Python 自带的。您返回的 ParseResult 将以一种很好的方式剥离主机/协议(protocol)等,然后您可以使用 str 的 split() 在路径分隔符上拆分.
对于 uri http://foo.com/apple/123
我想得到'123'。
根据 GAE 文档,我可以使用 self.request.get() 获取 uri,但是是否有仅获取 uri 部分的助手?
请您参考如下方法:
Yes there is - the urlparse module Python 自带的。您返回的 ParseResult 将以一种很好的方式剥离主机/协议(protocol)等,然后您可以使用 str 的 split() 在路径分隔符上拆分.