在python 3.2.2中,当我尝试在正则表达式模式中使用*时,我遇到了奇怪的错误.当*stads之后/ all都没问题.但是当我尝试从模式中删除/时,此代码会出现错误:sre_constants.error:字符范围错误
import re
foo = re.search("[^123+-/*]", "123+-/*w")
if foo:
print("foo")
else:
print("doo")
Run Code Online (Sandbox Code Playgroud)
在python文档中,我发现使用*是可以接受的,没有任何反斜杠或其他东西.但是像这样的代码的问题仍然存在.
我知道,我可以使用这样的东西:
- site.posts.each(function(article){
h2.title= article.title
p.article= arcticle.content
- })
Run Code Online (Sandbox Code Playgroud)
我觉得这样做是错误的,因为Jade有自己的原生结构来循环来自comethig,但它似乎不起作用:
each article in site.posts
h2.title= article.title
p.article= arcticle.content
Run Code Online (Sandbox Code Playgroud)