Book Read Free

Automate the Boring Stuff with Python

Page 52

by Al Sweigart


  storing variables as, Removing Values from Lists with del Statements

  using with for loops, Using for Loops with Lists

  ljust() method, The join() and split() String Methods

  load_workbook() function, Reading Excel Documents

  loads() function, JSON and APIs, Step 2: Download the JSON Data

  local scope, Local and Global Scope

  locateAllOnScreen() function, Image Recognition

  locateOnScreen() function, Project: Extending the mouseNow Program

  location attribute, Finding Elements on the Page

  logging, Using the logging Module, Using the logging Module, Logging Levels, Disabling Logging

  disabling, Logging Levels

  to file, Disabling Logging

  levels of, Using the logging Module

  print() function and, Using the logging Module

  logging module, Using an Assertion in a Traffic Light Simulation

  logging out, of automation program, Controlling the Keyboard and Mouse with GUI Automation

  login() method, Connecting to an SMTP Server, Connecting to an IMAP Server, Step 3: Send Customized Email Reminders

  logo, adding to an image, Project: Adding a Logo, Project: Adding a Logo, Step 1: Open the Logo Image, Step 2: Loop Over All Files and Open Images, Step 3: Resize the Images

  looping over files, Step 1: Open the Logo Image

  opening logo image, Project: Adding a Logo

  overview, Step 3: Resize the Images

  resizing image, Step 2: Loop Over All Files and Open Images

  logout() method, Getting the Body from a Raw Message

  LogRecord objects, Using an Assertion in a Traffic Light Simulation

  loops, while Loop Statements, An Annoying while Loop, continue Statements, continue Statements, An Equivalent while Loop, Using for Loops with Lists, Reading Data from Reader Objects in a for Loop

  break statements, An Annoying while Loop

  continue statements, continue Statements

  for loop, continue Statements

  range() function for, An Equivalent while Loop

  reading data from CSV file, Reading Data from Reader Objects in a for Loop

  using lists with, Using for Loops with Lists

  while loop, while Loop Statements

  lower() method, The upper(), lower(), isupper(), and islower() String Methods

  lstrip() method, Justifying Text with rjust(), ljust(), and center()

  M

  %M directive, Pausing Until a Specific Date

  %m directive, Pausing Until a Specific Date

  Mac OS X, Files and File Paths (see OS X)

  Magic 8 Ball example program, Sorting the Values in a List with the sort() Method

  makedirs() function, Absolute vs. Relative Paths, Step 2: Loop Over All Files and Open Images

  maps, open when location is copied, Web Scraping, Web Scraping, Web Scraping, Step 1: Figure Out the URL, Step 3: Handle the Clipboard Content and Launch the Browser, Step 3: Handle the Clipboard Content and Launch the Browser

  figuring out URL, Web Scraping

  handling clipboard content, Step 3: Handle the Clipboard Content and Launch the Browser

  handling command line argument, Step 1: Figure Out the URL

  launching browser, Step 3: Handle the Clipboard Content and Launch the Browser

  overview, Web Scraping

  Match objects, Creating Regex Objects

  math, What Is Python?, Entering Expressions into the Interactive Shell

  operators for, Entering Expressions into the Interactive Shell

  programming and, What Is Python?

  mergePage() method, Overlaying Pages

  Message objects, Sending Text Messages

  methods, Methods, Methods, Methods, Methods, Adding Values to Lists with the append() and insert() Methods, Removing Values from Lists with remove(), Dictionaries vs. Lists, Dictionaries vs. Lists, Dictionaries vs. Lists, Checking Whether a Key or Value Exists in a Dictionary, The setdefault() Method, The upper(), lower(), isupper(), and islower() String Methods, The upper(), lower(), isupper(), and islower() String Methods, The upper(), lower(), isupper(), and islower() String Methods, The upper(), lower(), isupper(), and islower() String Methods, The upper(), lower(), isupper(), and islower() String Methods, The upper(), lower(), isupper(), and islower() String Methods, The upper(), lower(), isupper(), and islower() String Methods, The isX String Methods, The isX String Methods, The isX String Methods, The isX String Methods, The isX String Methods, The isX String Methods, The join() and split() String Methods, The join() and split() String Methods, The join() and split() String Methods, Justifying Text with rjust(), ljust(), and center(), Justifying Text with rjust(), ljust(), and center(), Justifying Text with rjust(), ljust(), and center(), Removing Whitespace with strip(), rstrip(), and lstrip(), Removing Whitespace with strip(), rstrip(), and lstrip(), Rotating and Flipping Images

  chaining calls, Rotating and Flipping Images

  defined, Methods

  dictionary, Dictionaries vs. Lists, Dictionaries vs. Lists, Dictionaries vs. Lists, Checking Whether a Key or Value Exists in a Dictionary, The setdefault() Method

  get() method, Checking Whether a Key or Value Exists in a Dictionary

  items() method, Dictionaries vs. Lists

  keys() method, Dictionaries vs. Lists

  setdefault() method, The setdefault() Method

  values() method, Dictionaries vs. Lists

  list, Methods, Methods, Methods, Adding Values to Lists with the append() and insert() Methods, Removing Values from Lists with remove()

  append() method, Methods

  index() method, Methods

  insert() method, Methods

  remove() method, Adding Values to Lists with the append() and insert() Methods

  sort() method, Removing Values from Lists with remove()

  string, The isX String Methods, The join() and split() String Methods, Removing Whitespace with strip(), rstrip(), and lstrip()

  center() method, The join() and split() String Methods

  copy() method, Removing Whitespace with strip(), rstrip(), and lstrip()

  endswith() method, The isX String Methods

  isalnum() method, The upper(), lower(), isupper(), and islower() String Methods

  isalpha() method, The upper(), lower(), isupper(), and islower() String Methods

  isdecimal() method, The upper(), lower(), isupper(), and islower() String Methods

  islower() method, The upper(), lower(), isupper(), and islower() String Methods

  isspace() method, The isX String Methods

  istitle() method, The isX String Methods

  isupper() method, The upper(), lower(), isupper(), and islower() String Methods

  join() method, The isX String Methods

  ljust() method, The join() and split() String Methods

  lower() method, The upper(), lower(), isupper(), and islower() String Methods

  lstrip() method, Justifying Text with rjust(), ljust(), and center()

  paste() method, Removing Whitespace with strip(), rstrip(), and lstrip()

  rjust() method, The join() and split() String Methods

  rstrip() method, Justifying Text with rjust(), ljust(), and center()

  split() method, The isX String Methods

  startswith() method, The isX String Methods

  strip() method, Justifying Text with rjust(), ljust(), and center()

  upper() method, The upper(), lower(), isupper(), and islower() String Methods

  Microsoft Windows, Files and File Paths (see Windows OS)

  middleClick() function, Clicking the Mouse, Review of the PyAutoGUI Functions

  modules, Importing Modules, The pip Tool

  importing, Importing Modules

  third-party, installing, The pip Tool

  modulus/remainder (%) operator, Entering Expressions into the Interactive Shell, The Multiple Assignment Trick

  Monty Python, What Is Python?

>   mouse, Pauses and Fail-Safes, Moving the Mouse, Moving the Mouse, Moving the Mouse, Step 1: Import the Module, Step 1: Import the Module, Step 1: Import the Module, Step 1: Import the Module, Step 3: Get and Print the Mouse Coordinates, Clicking the Mouse, Clicking the Mouse, Dragging the Mouse, Analyzing the Screenshot

  controlling, Pauses and Fail-Safes, Step 3: Get and Print the Mouse Coordinates, Clicking the Mouse, Clicking the Mouse, Dragging the Mouse

  clicking mouse, Clicking the Mouse

  dragging mouse, Clicking the Mouse

  scrolling mouse, Dragging the Mouse

  determining position of, Moving the Mouse

  locating, Moving the Mouse, Moving the Mouse, Step 1: Import the Module, Step 1: Import the Module, Step 1: Import the Module, Step 1: Import the Module

  getting coordinates, Step 1: Import the Module

  handling KeyboardInterrupt exception, Step 1: Import the Module

  importing pyautogui module, Step 1: Import the Module

  infinite loop, Step 1: Import the Module

  overview, Moving the Mouse

  and pixels, identifying colors of, Analyzing the Screenshot

  mouseDown() function, Clicking the Mouse, Review of the PyAutoGUI Functions

  mouse.position() function, Step 1: Import the Module

  mouseUp() function, Review of the PyAutoGUI Functions

  move() function, Copying Files and Folders

  moveRel() function, Controlling Mouse Movement, Moving the Mouse, Clicking the Mouse, Review of the PyAutoGUI Functions

  moveTo() function, Controlling Mouse Movement, Clicking the Mouse, Review of the PyAutoGUI Functions

  moving files/folders, Copying Files and Folders

  multiclipboard project, Step 4: Write Content to the Quiz and Answer Key Files, Step 4: Write Content to the Quiz and Answer Key Files, Step 1: Comments and Shelf Setup, Step 1: Comments and Shelf Setup, Step 2: Save Clipboard Content with a Keyword, Step 2: Save Clipboard Content with a Keyword

  listing keywords, Step 2: Save Clipboard Content with a Keyword

  loading keyword content, Step 2: Save Clipboard Content with a Keyword

  overview, Step 4: Write Content to the Quiz and Answer Key Files

  saving clipboard content, Step 1: Comments and Shelf Setup

  setting up shelf file, Step 1: Comments and Shelf Setup

  multiline comments, Multiline Strings with Triple Quotes

  multiline strings, Escape Characters

  multiple assignment trick, The in and not in Operators

  multiplication (*) operator, Entering Expressions into the Interactive Shell, Getting a List’s Length with len(), The Multiple Assignment Trick

  multithreading, Multithreading, Multithreading, Multithreading, Multithreading, Passing Arguments to the Thread’s Target Function, Passing Arguments to the Thread’s Target Function, Project: Multithreaded XKCD Downloader, Project: Multithreaded XKCD Downloader, Step 1: Modify the Program to Use a Function, Step 2: Create and Start Threads, Step 2: Create and Start Threads

  concurrency issues, Passing Arguments to the Thread’s Target Function

  downloading multiple images,, Project: Multithreaded XKCD Downloader, Project: Multithreaded XKCD Downloader, Step 1: Modify the Program to Use a Function, Step 2: Create and Start Threads

  creating and starting threads, Step 1: Modify the Program to Use a Function

  using downloadXkcd() function, Project: Multithreaded XKCD Downloader

  waiting for threads to end, Step 2: Create and Start Threads

  join() method, Step 2: Create and Start Threads

  overview, Multithreading

  passing arguments to threads, Multithreading

  start() method, Multithreading, Passing Arguments to the Thread’s Target Function

  Thread() function, Multithreading

  mutable data types, List-like Types: Strings and Tuples

  N

  NameError, Removing Values from Lists with del Statements

  namelist() method, Compressing Files with the zipfile Module

  negative character classes, Character Classes

  negative indexes, Negative Indexes

  nested lists and dictionaries, A Tic-Tac-Toe Board

  newline keyword argument, Reading Data from Reader Objects in a for Loop

  None value, Return Values and return Statements

  nongreedy matching, Greedy and Nongreedy Matching, The Wildcard Character

  dot, star, and question mark for, The Wildcard Character

  in regular expressions, Greedy and Nongreedy Matching

  not equal to (!=) operator, Boolean Values

  not in operator, The in and not in Operators, Checking Whether a Key or Value Exists in a Dictionary, Indexing and Slicing Strings

  using with dictionaries, Checking Whether a Key or Value Exists in a Dictionary

  using with lists, The in and not in Operators

  using with strings, Indexing and Slicing Strings

  not operator, Binary Boolean Operators

  NOT search key, Performing the Search

  now() function, The datetime Module, Review of Python’s Time Functions

  O

  ON search key, Selecting a Folder

  open() function, The File Reading/Writing Process, Web Scraping, Task Scheduler, launchd, and cron, Manipulating Images with Pillow

  opening files, The File Reading/Writing Process

  OpenOffice, Working with Excel Spreadsheets, Step 4: Save the Results

  open program, Task Scheduler, launchd, and cron

  openpyxl module, installing, Working with Excel Spreadsheets

  operators, Entering Expressions into the Interactive Shell, Entering Expressions into the Interactive Shell, Boolean Values, Comparison Operators, Binary Boolean Operators, The Multiple Assignment Trick

  augmented assignment, The Multiple Assignment Trick

  binary, Comparison Operators

  comparison, Boolean Values

  defined, Entering Expressions into the Interactive Shell

  math, Entering Expressions into the Interactive Shell

  using binary and comparison operators together, Binary Boolean Operators

  order of operations, Entering Expressions into the Interactive Shell

  or operator, Binary Boolean Operators

  OR search key, Performing the Search

  OS X, What Is Python?, Downloading and Installing Python, Starting IDLE, Files and File Paths, Launching Other Programs from Python, Task Scheduler, launchd, and cron, Opening Files with Default Applications, Opening Files with Default Applications, Controlling the Keyboard and Mouse with GUI Automation, Installing Third-Party Modules, The pip Tool, Running Python Programs on OS X and Linux

  backslash vs. forward slash, Files and File Paths

  installing Python, Downloading and Installing Python

  installing third-party modules, The pip Tool

  launchd, Launching Other Programs from Python

  launching processes from Python, Opening Files with Default Applications

  logging out of automation program, Controlling the Keyboard and Mouse with GUI Automation

  opening files with default applications, Task Scheduler, launchd, and cron

  pip tool on, Installing Third-Party Modules

  Python support, What Is Python?

  running Python programs on, Running Python Programs on OS X and Linux

  starting IDLE, Starting IDLE

  Unix philosophy, Opening Files with Default Applications

  outline attribute, Run Attributes

  Outlook.com, Connecting to an SMTP Server, Retrieving and Deleting Emails with IMAP

  P

  %p directive, Pausing Until a Specific Date

  page breaks, Word document, Adding Headings

  Page objects, Extracting Text from PDFs

  Paragraph objects, Word Documents

  paragraphs, Word document, Getting the Full Text from a .docx File

  parameters, fu
nction, def Statements with Parameters

  parentheses (), Mutable and Immutable Data Types, Review of Regular Expression Matching

  parsing, defined, Parsing HTML with the BeautifulSoup Module

  passing arguments, Comments

  passing references, Passing References

  passwords, Copying and Pasting Strings with the pyperclip Module, Copying and Pasting Strings with the pyperclip Module, Copying and Pasting Strings with the pyperclip Module, Step 1: Program Design and Data Structures, Step 1: Program Design and Data Structures, Logging in to the SMTP Server

  application-specific, Logging in to the SMTP Server

  managing project, Copying and Pasting Strings with the pyperclip Module, Copying and Pasting Strings with the pyperclip Module, Copying and Pasting Strings with the pyperclip Module, Step 1: Program Design and Data Structures, Step 1: Program Design and Data Structures

  command-line arguments, Step 1: Program Design and Data Structures

  copying password, Step 1: Program Design and Data Structures

  data structures, Copying and Pasting Strings with the pyperclip Module

  overview, Copying and Pasting Strings with the pyperclip Module

  pastebin.com, Summary

  paste() method, Removing Whitespace with strip(), rstrip(), and lstrip(), Copying and Pasting Images onto Other Images, Copying and Pasting Images onto Other Images

  paths, Reading and Writing Files, Files and File Paths, The Current Working Directory, The Current Working Directory, The os.path Module, The os.path Module, The os.path Module, Handling Absolute and Relative Paths, Handling Absolute and Relative Paths, Finding File Sizes and Folder Contents

  absolute vs. relative, The Current Working Directory

 

‹ Prev