import asyncio,orm
from models import User, Blog, Comment
async def test():
loop = asyncio.get_event_loop()
await orm.create_pool(loop=loop, user='root', password='901025nba', db='awesome')
u = User(name='Test', email='test@example.com', passwd='1234567890', image='about:blank')
await u.save()
for x in test():
pass
TypeError: 'coroutine' object is not iterable
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
没有return
异步函数应用 await 调用
想想test()返回啥?能迭代吗?