Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想获取一个网站的域名(例如“www.google.com”)作为传递给处理程序的参数app = tornado.web.Application(handlers=[(r"/(\w+)", IndexHandler)]。
app = tornado.web.Application(handlers=[(r"/(\w+)", IndexHandler)]
当我运行我的测试文件时,它失败了,因为 "www.google.com" 与 pattern 不匹配(\w+)。
(\w+)
我所知道(\w+)的是它可以表示一串字符。我什至不知道是否(\w+)称为 Tornado url regex,但我想了解更多。
\w表示单词字符
\w
相当于[a-zA-Z0-9_]
[a-zA-Z0-9_]