gpt4 book ai didi

python - 匹配所有内容的 python 正则表达式是什么?

转载 作者:太空宇宙 更新时间:2023-11-04 09:06:11 24 4
gpt4 key购买 nike

所以我有一个只有 1 个应用程序的 django 站点,但我想维护建议的文件夹结构,所以我希望所有对根 url conf 的传入请求都转到该 1 个应用程序的 urls.py

基本上我有这样的结构

site/  
site/
urls.py
settings.py
...
app/
urls.py
...

我希望 site/urls.py 看起来像这样

url(r'*matching anything here*', include('app.urls')),

我只是不知道如何制作一个正则表达式来匹配任意长度的任意一组字符。基本上一切。

我试过用

r'(?i).' 

但是好像还是不行

最佳答案

对于include你需要给出路径前缀;在这种情况下是 ^:

url(r'^', include('app.urls')),

关于python - 匹配所有内容的 python 正则表达式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20664641/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com