How do i watch python source code files and restart when i save?

后端 未结 5 775
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 12:27

When I save a python source code file, I want to re-run the script. Is there a command that works like this (sort of like nodemon for node)?

5条回答
  •  醉梦人生
    2020-12-28 13:20

    You can install nodemon to watch for file changes.

    e.g.

    npm i -g nodemon
    

    Then to use:

    nodemon --exec python3 hello.py 
    

    This is for when you use python3 in the command line. On windows you can also use 'py' instead.

提交回复
热议问题