Skip to main content

Python Data Structures: Containers Study Guide

This guide covers essential Python programming concepts for file handling, including text and binary file operations, sequential and random access methods, and utilizing the 'os' module for system-level file management. It is suitable for learners seeking to understand how to interact with files and the operating system programmatically.

Save this study guide to your study set

Sign up free

Your learning path

Python Programming and Geospatial Data Management

Understanding Geospatial Data Formats and Organization

This lesson covers how GIS place data into physical data structures using binary and ASCII text formats, including vector and raster data models.

  • Binary and ASCII text files
  • Well-known text (WKT)
  • Well-known binary (WKB)
  • Vector data model
  • Raster data model
  • Coordinate reference systems
  • Topology
  • Geospatial data storage

Opening Reading and Writing Text Files

Methods for using file objects to open, read, and write text files using open, readline, read, and readlines.

  • open() function
  • file object properties
  • file modes
  • reading text files
  • writing text files
  • f.read()
  • f.readlines()
  • for loop file reading
  • while loop file reading

Methods for Reading and Processing Files

Methods for reading a file using the with keyword and storing data in a dictionary using tuples as keys.

  • with keyword
  • file objects
  • reading a file
  • dictionary
  • tuple
  • float-type values
  • split by blanks/tabs

Python File Writing and System Access

Methods for writing a file, closing a file, and using the os module for operating system functionality.

  • f.write()
  • f.writelines()
  • f.close()
  • internal buffer
  • os module
  • os.path.exists()
  • os.remove()
  • os.rename()
  • os.chdir()
  • os.mkdir()
  • os.getcwd()
  • os.listdir()
  • os.path.basename()
  • os.path.dirname()
  • os.path.split()
  • os.path.join()

Programming Basics and Python Core Concepts

An introduction to programming languages, Python characteristics, data types, variables, operators, and debugging processes.

  • High-level languages
  • Low-level languages
  • Interpreters
  • Compilers
  • Syntax errors
  • Runtime errors
  • Semantic errors
  • Debugging
  • Python modules
  • Python statements
  • Floats
  • Strings
  • Variables
  • Conditional statements
  • Expressions
  • Arithmetic operators
  • String operators
  • Logical operators
  • Comparison operators

Python Containers and Object-Oriented Programming

Introduction to Python Containers

Python containers are compound objects that contain other objects, including lists, strings, tuples, dictionaries, and sets.

  • Lists
  • Dictionaries
  • Strings
  • Tuples
  • Sets
  • List indexing
  • List slicing
  • List mutability
  • Dictionary key-value pairs
  • String traversal
  • Tuple immutability
  • Set uniqueness

Introduction to Classes and Objects

This lesson introduces Object-Oriented Programming concepts including classes as abstractions of real-world entities and objects as instances with attributes and behaviors.

  • Object-Oriented Programming
  • Class abstraction
  • Objects and instances
  • Attributes and behaviors
  • Class definition syntax
  • Instance creation
  • Data attribute assignment
  • Dot notation

Python Classes and Objects in OOP

This content explains Python classes, objects, attributes, and methods within Object-Oriented Programming.

  • Public, protected, and private attributes
  • Class attributes
  • Class methods
  • Instance methods
  • Static methods
  • Class initialization (constructor)
  • __init__ method
  • __str__ method
  • __dict__ property
  • vars() function

Python Classes and Object Inheritance

This content covers Python class methods, inheritance, and class method override within the context of object-oriented programming.

  • Class methods
  • Inheritance
  • Base class
  • Subclass
  • Class initialization
  • Method override
  • Public, protected, and private attributes
  • Composition

Python Classes, Inheritance, and Composition

This content explores object oriented design concepts including class inheritance and composition using Python examples like Point, Polyline, and Polygon.

  • Class Inheritance
  • Composition
  • Object oriented design
  • Composite class
  • Component class
  • Nested objects
  • Python functions
  • Attributes

Python Flow Control and Function Fundamentals

Python Flow Control and Functions

This lesson covers the flow of execution, including functions, conditionals, and loops, as well as the use of the main function and modules in Python.

  • Flow of execution
  • Functions
  • Conditional statements
  • Loops
  • Break statements
  • Python modules
  • Main function
  • __name__ attribute

Programming Flow Control and Recursion

This content explains recursion, mathematical factorials, and the syntax of for-loops used to iterate over a sequence.

  • Recursion
  • Mathematical factorial
  • Loops
  • Iteration
  • For-loop syntax
  • Sequence
  • Loop variable

Python Flow Control and Iteration

This content explains how to use for-loops, while-loops, and the range() function to control loop execution and iteration.

  • For-Loop
  • range() function
  • break
  • continue
  • Iteration
  • Recursion
  • While-Loops

Introduction to Python Flow Control

This content covers programming control structures including while-loops, for-loops, conditional statements, and handling exceptions.

  • While-Loops
  • Infinite While-Loops
  • Break statement
  • Continue statement
  • For loop
  • Conditional Statements
  • If-else Statement
  • If-elif Statements
  • Nested conditionals
  • Boolean expression
  • Runtime errors
  • Exceptions
  • Try...except clause

Introduction to Python Functions

A block of code designed for a specialized task that utilizes arguments, parameters, and return values.

  • Function
  • Argument
  • Parameter
  • Return value
  • Built-in functions
  • Modules
  • Optional arguments
  • Type conversion
  • Unique identifier
  • Math functions

Python Math Functions and Function Definitions

This content covers trigonometric math functions and the principles of adding new functions using repetition, modularity, and return values.

  • trigonometric functions
  • math.sin()
  • math.degrees()
  • repetition
  • modularity
  • function definition syntax
  • function calls
  • return keyword
  • parameters
  • indented blocks

Python Functions with Return Values

This lecture covers writing fruitful functions using return statements, handling multiple return paths, avoiding dead code, and returning multiple values via tuples.

  • fruitful functions
  • return statement
  • conditional branches
  • dead code
  • NoneType
  • multiple return values
  • tuples

Python Functions and Variable Scope

This content explains Python function definitions using default parameter values, keyword arguments, and the distinction between global and local variables.

  • Default parameter values
  • Keyword arguments
  • Local variables
  • Global variables
  • Python scope

Make it your own.

Keep these readings and topics in a new study set, or add them to one you already use.