我正在尝试将一个字符串从Html页传递到视图.py在
字符串有一些特殊字符,字符串:
Clarithromycin 500 MG Extended Release Tablet;http://purl.bioontology.org/ontology/RXNORM/;259543;9/4/2010;2;d;1 bid;Prescription;http://smartplatforms.org/terms/codes/MedicationProvenance#;prescription ;1;{tablet} ;7/7/2014;2007-10-03 03:00:00+03;
我发现问题出在网址.py在正则表达式中。字符串不在特殊字符“#”之后传递
在网址.py公司名称:
^{pr2}$我也试过了
(r'^bulkimport/importMedications/(?P<stringP>[\w\+%_&\# ].+)', importMedications),
传递的字符串是:
Clarithromycin 500 MG Extended Release Tablet;http:/purl.bioontology.org/ontology/RXNORM/;259543;9/4/2010;2;d;1 bid;Prescription;http:/smartplatforms.org/terms/codes/MedicationProvenance
如果我删除字符“#”,则所有字符串都将被传递。在
我也有同样的问题。我不能传递'+'字符。我做了以下工作:
然后我用了q嫒请求.GET. 在
哈希标记
#
是url中的保留字符,它引入了fragment identifier。在要在URL中使用它,您必须percent escape将其命名为
%23
。您可以使用urllib.quote来执行此操作。在但是,如果可能的话,我强烈建议您使用POST请求来导入数据。在
相关问题 更多 >
编程相关推荐