安装(Install)
pip install sanicHello, world 应用(Hello, world application)
from sanic import Sanic
from sanic.response import text
app = Sanic("MyHelloWorldApp")
@app.get("/")
async def hello_world(request):
    return text("Hello, world.")运行(Running)
让我们将上面写好的文件保存为 server.py, 然后运行它。
sanic server.app 
  
    
![[Python]初识sanic_文件保存](https://file.cfanz.cn/uploads/png/2023/04/24/2/B274N833cC.png)
  
运行效果
       
![[Python]初识sanic_文件保存_02](https://file.cfanz.cn/uploads/png/2023/04/24/2/72C08e1CU2.png)
  










