在标准库的"字符串"模块中,
string.ascii_letters ## Same as string.ascii_lowercase + string.ascii_uppercase
Run Code Online (Sandbox Code Playgroud)
是
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
Run Code Online (Sandbox Code Playgroud)
是否有一个类似的常量,包括所有被认为是unicode中的字母的东西?
一旦我的应用程序发送了回复,我希望GAE做一些其他事情.
处理程序看起来像这样:
class FooHandler(webapp.RequestHandler):
def post(self):
self.response.out.write('Bar')
send_response() # this is where I need help!
do_something_else() # at this point, the response should have been sent
Run Code Online (Sandbox Code Playgroud)
万一你想知道我为什么要这样做:
我需要类似线程的行为,这是GAE的沙盒环境所不允许的.因此,一个函数发送几个请求,而不关心响应.每个请求都会启动一个耗时的操作(获取资源)并将结果保存到数据存储区中,第一个函数可以使用它.
注意:请求处理程序必须发送响应.如果你不提供任何,它将等待post函数完成然后返回默认标题(当然这不是我正在寻找的行为)
如果这可以帮助,解决方案可能是使用自定义wsgi middeleware,但我不知道它是如何工作的(还)...