from django.conf.urls import *找不到patterns模块? Django-1.10,python27
这个特性在1.9就声明了deprecated. 1.10正式移除了。使用 django 1.10 需要改用 django.conf.urls.url() 示范代拦码码:空衡滚
from django.conf.urls import url
from 斗余. import views
urlpatterns = [
url(r'^articles/2003/$', views.special_case_2003),
url(r'^articles/([0-9]{4})/$', views.year_archive),
url(r'^articles/([0-9]{4})/([0-9]{2})/$', views.month_archive),
url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail),
]
使用 django 1.10 需要改用 django.conf.urls.url() 代码:
12345678910from django.conf.urls import url from . import views urlpatterns = [ url(r'^articles/2003/$', views.special_case_2003), url(r'^articles/([0-9]{4})/$', views.year_archive), url(r'^articles/([0-9]{4})/([0-9]{2})/$', views.month_archive), url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail),]
一个使用QtXmlPatterns模块读取xml 的例子:
#include <QApplication>
#include <QFile>
#include <QBuffer>
#include <QIODevice>
#include <QtXmlPatterns>
#include <QXmlFormatter>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QFile sourceDocument; 燃桐
sourceDocument.setFileName("cookbook.xml");
sourceDocument.open(QIODevice::ReadOnly);
QXmlQuery 皮圆坦query;
query.bindVariable("inputDocument", &sourceDocument);
//之所以要将绑定 inputDocument 变量,估计是腔喊为了把需要查询的 xml 文件设置为可读模式,然后才能 setQuery 查询。