Movatterモバイル変換


[0]ホーム

URL:


Defining Main Functions in Python

Defining Main Functions in Python

Many programming languages have a special function that is automatically executed when an operating system starts to run a program. This function is usually calledmain() and must have a specific return type and arguments according to the language standard. On the other hand, the Python interpreter executes scripts starting at the top of the file, and there is no specific function that Python automatically executes.

Nevertheless, having a defined starting point for the execution of a program is useful for understanding how a program works. Python programmers have come up with several conventions to define this starting point.

By the end of this course, you’ll understand:

  • What the special__name__ variable is and how Python defines it
  • Why you would want to use amain() in Python
  • What conventions there are for definingmain() in Python
  • What the best practices are for what code to put into yourmain()

What’s Included:

  • 5 Lessons
  • Video Subtitles and Full Transcripts
  • 2 Downloadable Resources
  • Accompanying Text-Based Tutorial
  • Interactive Quiz to Check Your Progress
  • Q&A With Python Experts: Ask a Question
  • Certificate of Completion

Downloadable Resources:

Start Now

Defining Main Functions in Python

5 Lessons 22m

  1. 1. Defining Main Functions in Python: Overview02:01
  2. 2. Execution Modes in Python04:48
  3. 3. Best Practices for Python Main Functions11:17
  4. 4. Defining Main Functions in Python (Quiz)04:00
  5. 5. Defining Main Functions in Python: Summary00:49
Start Now

AboutRich Bibby

Rich is an avid Pythonista and a video instructor at Real Python. He is also a Network Engineer using Python to automate the management of a large network infrastructure. He lives in Dubai, UAE, with his wife and daughter plus a Miniature Schnauzer.

» More about Rich

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses


[8]ページ先頭

©2009-2026 Movatter.jp