Automate the Boring Stuff with Python

Home > Other > Automate the Boring Stuff with Python > Page 55
Automate the Boring Stuff with Python Page 55

by Al Sweigart


  slicing, Multiline Strings with Triple Quotes

  split() method, The isX String Methods

  startswith() method, The isX String Methods

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

  substituting using regular expressions, Case-Insensitive Matching

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

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

  strptime() function, Converting datetime Objects into Strings, Review of Python’s Time Functions

  strs, The Integer, Floating-Point, and String Data Types

  (see also strings)

  Style objects, Setting the Font Style of Cells

  SUBJECT search key, Selecting a Folder

  sublists, getting with slices, Negative Indexes

  sub() method, Case-Insensitive Matching

  submitButtonColor variable, Step 1: Figure Out the Steps, Step 3: Start Typing Data

  submitButton variable, Step 1: Figure Out the Steps

  submit() method, Filling Out and Submitting Forms

  subprocess module, Keeping Time, Scheduling Tasks, and Launching Programs, Step 2: Create and Start Threads

  subtraction (-) operator, Entering Expressions into the Interactive Shell, The Multiple Assignment Trick

  subtractive color model, Colors and RGBA Values

  Sudoku puzzles, What Is Python?

  sys.exit() function, Importing Modules

  T

  tag_name attribute, Finding Elements on the Page

  Tag objects, Creating a BeautifulSoup Object from HTML

  tags, HTML, Saving Downloaded Files to the Hard Drive

  Task Scheduler, Launching Other Programs from Python

  termination, program, Your First Program, Importing Modules

  text attribute, Reading Word Documents, Run Attributes

  text messaging, Sending Text Messages with Twilio, Sending Text Messages, Project: “Just Text Me” Module

  automatic notifications, Project: “Just Text Me” Module

  sending messages, Sending Text Messages

  Twilio service, Sending Text Messages with Twilio

  text() method, Drawing Example

  TEXT search key, Selecting a Folder

  textsize() method, Drawing Text

  third-party modules, installing, Installing Third-Party Modules

  Thread() function, Multithreading, Step 1: Modify the Program to Use a Function

  threading module, Keeping Time, Scheduling Tasks, and Launching Programs, Multithreading

  Thread objects, Multithreading

  threads, Multithreading, Multithreading, Passing Arguments to the Thread’s Target Function, Project: Multithreaded XKCD Downloader, Step 2: Create and Start Threads, Step 2: Create and Start Threads

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

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

  multithreading, Multithreading, Project: Multithreaded XKCD Downloader

  image downloader, Project: Multithreaded XKCD Downloader

  passing arguments to, Multithreading

  processes vs., Step 2: Create and Start Threads

  tic-tac-toe board, Using Data Structures to Model Real-World Things

  timedelta data type, The datetime Module, Review of Python’s Time Functions

  timedelta objects, The datetime Module

  time module, The time Module, The time.time() Function, The time.sleep() Function, Pausing Until a Specific Date, Review of Python’s Time Functions

  overview, Review of Python’s Time Functions

  sleep() function, The time.time() Function, Pausing Until a Specific Date

  stopwatch project, The time.sleep() Function

  time() function, The time Module

  TLS encryption, Connecting to an SMTP Server

  top-level domains, Step 2: Create a Regex for Email Addresses

  TO search key, Performing the Search

  total_seconds() method, The datetime Module, Review of Python’s Time Functions

  traceback, getting from error, Raising Exceptions

  transparency, Computer Image Fundamentals, Copying and Pasting Images onto Other Images

  transpose() method, Rotating and Flipping Images

  triple quotes ('''), Escape Characters, Managing Complex Regexes

  truetype() function, Drawing Text

  truth tables, Comparison Operators

  “truthy” values, continue Statements

  tuple data type, Mutable and Immutable Data Types, The Tuple Data Type

  overview, Mutable and Immutable Data Types

  tuple() function, The Tuple Data Type

  twilio module, Sending Text Messages with Twilio

  TwilioRestClient objects, Sending Text Messages

  Twilio service, Sending Text Messages with Twilio, Sending Text Messages, Project: “Just Text Me” Module

  automatic text messages, Project: “Just Text Me” Module

  overview, Sending Text Messages with Twilio

  sending text messages, Sending Text Messages

  TypeError, Getting Individual Values in a List with Indexes, List-like Types: Strings and Tuples

  typewrite() function, Image Recognition, Sending a String from the Keyboard, Review of the PyAutoGUI Functions, Project: Automatic Form Filler, Step 3: Start Typing Data, Step 4: Handle Select Lists and Radio Buttons

  U

  Ubuntu, Downloading and Installing Python, Launching Other Programs from Python, Launching Other Programs from Python, Task Scheduler, launchd, and cron, Opening Files with Default Applications

  cron, Launching Other Programs from Python

  launching processes from Python, Launching Other Programs from Python

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

  Unix philosophy, Opening Files with Default Applications

  UNANSWERED search key, Performing the Search

  UNDELETED search key, Performing the Search

  underline attribute, Run Attributes

  underscore (_), Variable Names

  UNDRAFT search key, Performing the Search

  UNFLAGGED search key, Performing the Search

  Unicode encodings, Saving Downloaded Files to the Hard Drive

  Unix epoch, The time Module, The datetime Module, Review of Python’s Time Functions

  Unix philosophy, Opening Files with Default Applications

  unlink() function, Moving and Renaming Files and Folders

  UNSEEN search key, Performing the Search

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

  UTC (Coordinated Universal Time), The time Module

  V

  ValueError, The Multiple Assignment Trick, Converting datetime Objects into Strings

  values, defined, Entering Expressions into the Interactive Shell, Finding Patterns of Text Without Regular Expressions

  values() method, Dictionaries vs. Lists

  variables, String Concatenation and Replication, String Concatenation and Replication, Assignment Statements, Assignment Statements, Variable Names, Return Values and return Statements, Local and Global Scope, Local and Global Variables with the Same Name, Removing Values from Lists with del Statements, Methods, The Tuple Data Type, Writing to Files

  (see also lists)

  assignment statements, String Concatenation and Replication

  defined, String Concatenation and Replication

  global, Local and Global Variables with the Same Name

  initializing, Assignment Statements

  local, Local and Global Scope

  naming, Variable Names

  None value and, Return Values and return Statements

  overwriting, Assignment Statements

  references, The Tuple Data Type

  saving with shelve module, Writing to Files

  storing as l
ist, Removing Values from Lists with del Statements

  Verizon mail, Connecting to an SMTP Server, Retrieving and Deleting Emails with IMAP

  volumes, defined, Files and File Paths

  W

  W character class, The findall() Method

  w character class, The findall() Method

  %w directive, Pausing Until a Specific Date

  walk() function, Safe Deletes with the send2trash Module, Launching Other Programs from Python

  WARNING level, Using the logging Module

  weather data, fetching, Reading JSON with the loads() Function, Reading JSON with the loads() Function, Step 1: Get Location from the Command Line Argument, Step 1: Get Location from the Command Line Argument, Step 2: Download the JSON Data

  downloading JSON data, Step 1: Get Location from the Command Line Argument

  getting location, Step 1: Get Location from the Command Line Argument

  loading JSON data, Step 2: Download the JSON Data

  overview, Reading JSON with the loads() Function

  webbrowser module, Web Scraping, Task Scheduler, launchd, and cron

  open() function, Task Scheduler, launchd, and cron

  opening browser using, Web Scraping

  WebDriver objects, Starting a Selenium-Controlled Browser

  WebElement objects, Starting a Selenium-Controlled Browser

  web scraping, Web Scraping, Web Scraping, Downloading Files from the Web with the requests Module, Downloading Files from the Web with the requests Module, Saving Downloaded Files to the Hard Drive, Saving Downloaded Files to the Hard Drive, Saving Downloaded Files to the Hard Drive, A Quick Refresher, Viewing the Source HTML of a Web Page, Using the Developer Tools to Find HTML Elements, Parsing HTML with the BeautifulSoup Module, Parsing HTML with the BeautifulSoup Module, Creating a BeautifulSoup Object from HTML, Getting Data from an Element’s Attributes, Getting Data from an Element’s Attributes, Step 3: Open Web Browsers for Each Result, Step 4: Save the Image and Find the Previous Comic, Step 4: Save the Image and Find the Previous Comic, Starting a Selenium-Controlled Browser, Finding Elements on the Page, Finding Elements on the Page, Filling Out and Submitting Forms, Sending Special Keys

  bs4 module, Parsing HTML with the BeautifulSoup Module, Parsing HTML with the BeautifulSoup Module, Creating a BeautifulSoup Object from HTML, Getting Data from an Element’s Attributes

  creating object from HTML, Parsing HTML with the BeautifulSoup Module

  finding element with select() method, Creating a BeautifulSoup Object from HTML

  getting attribute, Getting Data from an Element’s Attributes

  overview, Parsing HTML with the BeautifulSoup Module

  downloading, Downloading Files from the Web with the requests Module, Saving Downloaded Files to the Hard Drive, Step 3: Open Web Browsers for Each Result

  files, Saving Downloaded Files to the Hard Drive

  images, Step 3: Open Web Browsers for Each Result

  pages, Downloading Files from the Web with the requests Module

  and Google maps project, Web Scraping

  and Google search project, Getting Data from an Element’s Attributes

  HTML, Saving Downloaded Files to the Hard Drive, Saving Downloaded Files to the Hard Drive, A Quick Refresher, Viewing the Source HTML of a Web Page, Using the Developer Tools to Find HTML Elements

  browser developer tools and, Viewing the Source HTML of a Web Page

  finding elements, Using the Developer Tools to Find HTML Elements

  learning resources, Saving Downloaded Files to the Hard Drive

  overview, Saving Downloaded Files to the Hard Drive

  viewing page source, A Quick Refresher

  overview, Web Scraping

  requests module, Downloading Files from the Web with the requests Module

  selenium module clicking buttons, Step 4: Save the Image and Find the Previous Comic, Step 4: Save the Image and Find the Previous Comic, Starting a Selenium-Controlled Browser, Finding Elements on the Page, Finding Elements on the Page, Filling Out and Submitting Forms, Sending Special Keys

  finding elements, Starting a Selenium-Controlled Browser

  following links, Finding Elements on the Page

  installing, Step 4: Save the Image and Find the Previous Comic

  sending special keystrokes, Filling Out and Submitting Forms

  submitting forms, Finding Elements on the Page

  using Firefox with, Step 4: Save the Image and Find the Previous Comic

  websites, opening from script, Task Scheduler, launchd, and cron

  while loops, while Loop Statements, Step 1: Import the Module, Step 1: Import the Module

  getting and printing mouse coordinates using, Step 1: Import the Module

  infinite, Step 1: Import the Module

  overview, while Loop Statements

  whitespace, removing, Justifying Text with rjust(), ljust(), and center()

  wildcard character (.), The Caret and Dollar Sign Characters

  Windows OS, What Is Python?, About This Book, Downloading and Installing Python, Files and File Paths, Launching Other Programs from Python, Launching Other Programs from Python, Task Scheduler, launchd, and cron, Controlling the Keyboard and Mouse with GUI Automation, Installing Third-Party Modules, The pip Tool, Shebang Line

  backslash vs. forward slash, Files and File Paths

  installing Python, About This Book

  installing third-party modules, The pip Tool

  launching processes from Python, Launching Other Programs from Python

  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, Shebang Line

  starting IDLE, Downloading and Installing Python

  Task Scheduler, Launching Other Programs from Python

  Word documents, Step 4: Save the Results, Step 4: Save the Results, Word Documents, Reading Word Documents, Getting the Full Text from a .docx File, Styling Paragraph and Run Objects, Run Attributes, Run Attributes, Writing Word Documents, Adding Headings, Adding Headings

  adding headings, Writing Word Documents

  creating documents with nondefault styles, Styling Paragraph and Run Objects

  format overview, Step 4: Save the Results

  getting text from, Reading Word Documents

  line/page breaks, Adding Headings

  pictures in, Adding Headings

  python-docx module, Step 4: Save the Results

  reading, Word Documents

  Run object attributes, Run Attributes

  styling paragraphs, Getting the Full Text from a .docx File

  writing to file, Run Attributes

  Workbook objects, Reading Excel Documents

  workbooks, Excel, Working with Excel Spreadsheets, Reading Excel Documents, Ideas for Similar Programs, Creating and Removing Sheets, Creating and Removing Sheets

  creating worksheets, Creating and Removing Sheets

  deleting worksheets, Creating and Removing Sheets

  opening, Reading Excel Documents

  saving, Ideas for Similar Programs

  Worksheet objects, Getting Sheets from the Workbook

  write() method, Reading the Contents of Files

  Writer objects, Reading Data from Reader Objects in a for Loop

  writerow() method, Writer Objects

  X

  XKCD comics, Step 3: Open Web Browsers for Each Result, Step 3: Open Web Browsers for Each Result, Project: Downloading All XKCD Comics, Step 1: Design the Program, Step 4: Save the Image and Find the Previous Comic, Project: Multithreaded XKCD Downloader, Project: Multithreaded XKCD Downloader, Step 1: Modify the Program to Use a Function, Step 2: Create and Start Threads

  downloading project, Step 3: Open Web Browsers for Each Result, Step 3: Open W
eb Browsers for Each Result, Project: Downloading All XKCD Comics, Step 1: Design the Program, Step 4: Save the Image and Find the Previous Comic

  designing program, Project: Downloading All XKCD Comics

  downloading web page, Step 1: Design the Program

  overview, Step 3: Open Web Browsers for Each Result

  saving image, Step 4: Save the Image and Find the Previous Comic

  multithreaded downloading project, 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

  Y

  %Y directive, Pausing Until a Specific Date

  %y directive, Pausing Until a Specific Date

  Yahoo! Mail, Connecting to an SMTP Server, Retrieving and Deleting Emails with IMAP

  Z

  zipfile module, Walking a Directory Tree, Compressing Files with the zipfile Module, Extracting from ZIP Files, Extracting from ZIP Files, Step 3: Form the New Filename and Rename the Files

  creating ZIP files, Extracting from ZIP Files

  extracting ZIP files, Extracting from ZIP Files

  and folders, Step 3: Form the New Filename and Rename the Files

  overview, Walking a Directory Tree

  reading ZIP files, Compressing Files with the zipfile Module

  ZipFile objects, Compressing Files with the zipfile Module

  ZipInfo objects, Compressing Files with the zipfile Module

 

‹ Prev