Python scripts can be executed by passing the script name to the python command or created as executable commands that can run stand-alone. You’ll learn how to create both in this lesson.

 

script.py:

print("Hello World")

 

When we want to run the script, we can do:

python3 script.py

 

We can also make the script a stand-alone executable:

#! /usr/bin/env python

print("Hello World")
chmod +x script.py
./script.py

 

相关文章:

  • 2021-05-23
  • 2021-09-10
  • 2021-09-01
  • 2021-06-04
  • 2021-09-13
  • 2021-08-31
  • 2021-06-30
  • 2021-07-29
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2022-01-15
相关资源
相似解决方案