Receive a quick introduction to the major parts of a Python script—comments, import statements, and the body of your script.
- [Instructor] A Python script is simple,…but it's somewhat different from other scripting languages.…Let's take a look at the different parts…of a Python script.…Here in Komodo, I've opened a working copy…of hello-version.py from Chapter Two of the exercise files,…and up here at the top, you'll see…the first two lines are comments.…So comments are introduced by the hash mark…or the pound sign, and the first comment…is a special case of a comment.…It's called a shebang line or sometimes hashbang.…
The shebang line is a common pattern for Unix based systems.…It allows a script to be invoked from the command line.…There are two parts to the shebang line.…The hash mark and the exclamation sign…must be the first two characters on the first line…of the file.…These marks together form the shebang.…An exclamation mark is sometimes called a bang,…so hash plus bang is where the word shebang comes from.…There must be no lines before this line,…and no spaces before these first two characters.…
Essentially, these two characters must be…
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api
Skill Level Intermediate
Python: Programming Efficiently (2017)with Michele Vallisneri2h 15m Intermediate
2. Language Overview
3. Types and Values
8. Structured Data
11. String Objects
12. File I/O
13. Built-in Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.