Automate the Boring Stuff with Python

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

by Al Sweigart

charts in, Freeze Panes

  column width, Formulas

  converting between column letters and numbers, Converting Between Column Letters and Numbers

  creating documents, Ideas for Similar Programs

  creating worksheets, Creating and Removing Sheets

  deleting worksheets, Creating and Removing Sheets

  font styles, Setting the Font Style of Cells

  formulas in, Font Objects

  freezing panes, Merging and Unmerging Cells

  getting cell values, Getting Sheets from the Workbook

  getting rows and columns, Converting Between Column Letters and Numbers

  getting worksheet names, Getting Sheets from the Workbook

  merging and unmerging cells, Setting Row Height and Column Width

  opening documents, Reading Excel Documents

  openpyxl module, Working with Excel Spreadsheets

  overview, Working with Excel Spreadsheets

  reading files, Getting Rows and Columns from the Sheets, Project: Reading Data from a Spreadsheet, Step 1: Read the Spreadsheet Data, Step 2: Populate the Data Structure

  overview, Getting Rows and Columns from the Sheets

  populating data structure, Step 1: Read the Spreadsheet Data

  reading data, Project: Reading Data from a Spreadsheet

  writing results to file, Step 2: Populate the Data Structure

  and reminder emails project, Disconnecting from the IMAP Server

  row height, Formulas

  saving workbooks, Ideas for Similar Programs

  updating, Writing Values to Cells, Writing Values to Cells, Project: Updating a Spreadsheet

  overview, Writing Values to Cells

  setup, Project: Updating a Spreadsheet

  workbooks vs., Working with Excel Spreadsheets

  writing values to cells, Creating and Removing Sheets

  Exception objects, Raising Exceptions

  exceptions, The global Statement, Debugging, Raising Exceptions, Assertions

  assertions and, Assertions

  getting traceback as string, Raising Exceptions

  handling, The global Statement

  raising, Debugging

  execution, program, Flow Control, Blocks of Code, Importing Modules, Pausing Until a Specific Date

  defined, Flow Control

  overview, Blocks of Code

  pausing until specific time, Pausing Until a Specific Date

  terminating program with sys.exit(), Importing Modules

  exists() function, Finding File Sizes and Folder Contents

  exit codes, Launching Other Programs from Python

  expand keyword, Rotating and Flipping Images

  exponent (**) operator, Entering Expressions into the Interactive Shell

  expressions, Entering Expressions into the Interactive Shell, Mixing Boolean and Comparison Operators

  conditions and, Mixing Boolean and Comparison Operators

  in interactive shell, Entering Expressions into the Interactive Shell

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

  extensions, file, Reading and Writing Files

  extractall() method, Extracting from ZIP Files

  extracting ZIP files, Extracting from ZIP Files

  extract() method, Extracting from ZIP Files

  F

  FailSafeException exception, Step 2: Set Up Coordinates

  “falsey” values, continue Statements

  fetch() method, Performing the Search, Size Limits

  file editor, Variable Names

  file management, Reading and Writing Files, Reading and Writing Files, Files and File Paths, The Current Working Directory, The Current Working Directory, Absolute vs. Relative Paths, 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, Finding File Sizes and Folder Contents, The File Reading/Writing Process, Opening Files with the open() Function, Reading the Contents of Files, Writing to Files, Saving Variables with the shelve Module, Step 4: Write Content to the Quiz and Answer Key Files, Organizing Files, Copying Files and Folders, Copying Files and Folders, Moving and Renaming Files and Folders, Permanently Deleting Files and Folders, Safe Deletes with the send2trash Module, Walking a Directory Tree, Compressing Files with the zipfile Module, Extracting from ZIP Files, Extracting from ZIP Files, Creating and Adding to ZIP Files, Step 3: Form the New Filename and Rename the Files

  absolute vs. relative paths, The Current Working Directory

  backslash vs. forward slash, Files and File Paths

  compressed files, 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

  backing up to, Step 3: Form the New Filename and Rename the Files

  creating ZIP files, Extracting from ZIP Files

  extracting ZIP files, Extracting from ZIP Files

  overview, Walking a Directory Tree

  reading ZIP files, Compressing Files with the zipfile Module

  creating directories, Absolute vs. Relative Paths

  current working directory, The Current Working Directory

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

  opening files, The File Reading/Writing Process

  os.path module, 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 paths in, The os.path Module

  file sizes, Handling Absolute and Relative Paths

  folder contents, Handling Absolute and Relative Paths

  overview, The os.path Module

  path validity, Finding File Sizes and Folder Contents

  relative paths in, The os.path Module

  overview, Reading and Writing Files

  paths, Reading and Writing Files

  plaintext vs. binary files, Finding File Sizes and Folder Contents

  reading files, Opening Files with the open() Function

  renaming files, date styles, Creating and Adding to ZIP Files

  saving variables with pformat() function, Saving Variables with the shelve Module

  send2trash module, Permanently Deleting Files and Folders

  shelve module, Writing to Files

  shutil module, Organizing Files, Copying Files and Folders, Copying Files and Folders, Moving and Renaming Files and Folders

  copying files/folders, Organizing Files

  deleting files/folders, Moving and Renaming Files and Folders

  moving files/folders, Copying Files and Folders

  renaming files/folders, Copying Files and Folders

  walking directory trees, Safe Deletes with the send2trash Module

  writing files, Reading the Contents of Files

  filenames, defined, Reading and Writing Files

  File objects, Opening Files with the open() Function

  findall() method, Greedy and Nongreedy Matching

  find_element_by_* methods, Starting a Selenium-Controlled Browser

  find_elements_by_* methods, Starting a Selenium-Controlled Browser

  Firefox, developer tools in, Opening Your Browser’s Developer Tools

  FLAGGED search key, Performing the Search

  flipping images, Rotating and Flipping Images

  float() function, The len() Function

  floating-point numbers, The Integer, Floating-Point, and String Data Types, The str(), int(), and float() Functions, The time.sleep() Function

  integer equivalence, The str(), int(), and float() Functions

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

  rounding, The time.sleep() Function

  flow control, Flow Control, Flow Control, Boolean Values, Comparison Operators, Binary Boolean Operators, Mixing Boolean and Comparison Operators, Mixing Boolean
and Comparison Operators, Blocks of Code, if Statements, else Statements, while Loop Statements, An Annoying while Loop, continue Statements

  binary operators, Comparison Operators

  blocks of code, Mixing Boolean and Comparison Operators

  Boolean values and, Flow Control

  break statements, An Annoying while Loop

  comparison operators, Boolean Values

  conditions, Mixing Boolean and Comparison Operators

  continue statements, continue Statements

  elif statements, else Statements

  else statements, if Statements

  if statements, Blocks of Code

  overview, Flow Control

  using binary and comparison operators together, Binary Boolean Operators

  while loops, while Loop Statements

  folders, Reading and Writing Files, Files and File Paths, The Current Working Directory, The Current Working Directory, Absolute vs. Relative Paths, 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, Organizing Files, Copying Files and Folders, Copying Files and Folders, Moving and Renaming Files and Folders, Permanently Deleting Files and Folders, Safe Deletes with the send2trash Module, Step 3: Form the New Filename and Rename the Files, Project: Backing Up a Folder into a ZIP File, Step 1: Figure Out the ZIP File’s Name, Step 1: Figure Out the ZIP File’s Name

  absolute vs. relative paths, The Current Working Directory

  backing up to ZIP file, Step 3: Form the New Filename and Rename the Files, Project: Backing Up a Folder into a ZIP File, Step 1: Figure Out the ZIP File’s Name, Step 1: Figure Out the ZIP File’s Name

  creating new ZIP file, Step 1: Figure Out the ZIP File’s Name

  figuring out ZIP filename, Project: Backing Up a Folder into a ZIP File

  walking directory tree, Step 1: Figure Out the ZIP File’s Name

  backslash vs. forward slash, Files and File Paths

  copying, Organizing Files

  creating, Absolute vs. Relative Paths

  current working directory, The Current Working Directory

  defined, Reading and Writing Files

  deleting permanently, Moving and Renaming Files and Folders

  deleting using send2trash module, Permanently Deleting Files and Folders

  moving, Copying Files and Folders

  os.path module, 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 paths in, The os.path Module

  file sizes, Handling Absolute and Relative Paths

  folder contents, Handling Absolute and Relative Paths

  overview, The os.path Module

  path validity, Finding File Sizes and Folder Contents

  relative paths in, The os.path Module

  renaming, Copying Files and Folders

  walking directory trees, Safe Deletes with the send2trash Module

  Font objects, Setting the Font Style of Cells

  font styles, in Excel spreadsheets, Setting the Font Style of Cells

  for loops, continue Statements, Using for Loops with Lists, The keys(), values(), and items() Methods

  overview, continue Statements

  using dictionary items in, The keys(), values(), and items() Methods

  using lists with, Using for Loops with Lists

  format attribute, Working with the Image Data Type

  format_description attribute, Working with the Image Data Type

  formData list, Step 2: Set Up Coordinates

  form filler project, Review of the PyAutoGUI Functions, Review of the PyAutoGUI Functions, Project: Automatic Form Filler, Step 1: Figure Out the Steps, Step 2: Set Up Coordinates, Step 3: Start Typing Data, Step 3: Start Typing Data, Step 4: Handle Select Lists and Radio Buttons

  overview, Review of the PyAutoGUI Functions

  radio buttons, Step 3: Start Typing Data

  select lists, Step 3: Start Typing Data

  setting up coordinates, Step 1: Figure Out the Steps

  steps in process, Project: Automatic Form Filler

  submitting form, Step 4: Handle Select Lists and Radio Buttons

  typing data, Step 2: Set Up Coordinates

  formulas, in Excel spreadsheets, Font Objects

  forward() method, Sending Special Keys

  forward slash (/), Files and File Paths

  FROM search key, Performing the Search

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

  functions, Comments, Importing Modules, Functions, def Statements with Parameters, def Statements with Parameters, def Statements with Parameters, def Statements with Parameters, Return Values and return Statements, Return Values and return Statements, The global Statement, The global Statement, Review of the PyAutoGUI Functions

  (see also names of individual functions)

  arguments, Comments, def Statements with Parameters

  as “black box”, The global Statement

  built-in, Importing Modules

  def statements, def Statements with Parameters

  exception handling, The global Statement

  keyword arguments, Return Values and return Statements

  None value and, Return Values and return Statements

  overview, Functions

  parameters, def Statements with Parameters

  return values, def Statements with Parameters

  G

  get_active_sheet() method, Getting Sheets from the Workbook

  get_addresses() method, Getting Email Addresses from a Raw Message

  get_attribute() method, Finding Elements on the Page

  getcolor() function, Computer Image Fundamentals, Working with the Image Data Type

  get_column_letter() function, Converting Between Column Letters and Numbers

  getcwd() function, The Current Working Directory

  get() function, Checking Whether a Key or Value Exists in a Dictionary, Downloading Files from the Web with the requests Module

  overview, Checking Whether a Key or Value Exists in a Dictionary

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

  get_highest_column() method, Getting Cells from the Sheets, Step 1: Open the Excel File

  get_highest_row() method, Getting Cells from the Sheets

  get_payload() method, Getting Email Addresses from a Raw Message

  getpixel() function, Changing Individual Pixels, Scrolling the Mouse, Analyzing the Screenshot

  get_sheet_by_name() method, Getting Sheets from the Workbook

  get_sheet_names() method, Getting Sheets from the Workbook

  getsize() function, Handling Absolute and Relative Paths

  get_subject() method, Getting Email Addresses from a Raw Message

  getText() function, Reading Word Documents

  GIF format, Working with the Image Data Type

  global scope, Local and Global Variables with the Same Name

  Gmail, Connecting to an SMTP Server, Logging in to the SMTP Server, Retrieving and Deleting Emails with IMAP

  gmail_search() method, Size Limits

  Google Maps, Web Scraping

  graphical user interface automation, Review of the PyAutoGUI Functions (see GUI (graphical user interface) automation)

  greater than (>) operator, Boolean Values

  greater than or equal to (>=) operator, Boolean Values

  greedy matching, Matching One or More with the Plus, The Wildcard Character

  dot-star for, The Wildcard Character

  in regular expressions, Matching One or More with the Plus

  group() method, Creating Regex Objects, Review of Regular Expression Matching

  groups, regular expression, Review of Regular Expression Matching, Grouping with Parentheses, Matching Multiple Groups with the Pipe, Optional Matchi
ng with the Question Mark, Optional Matching with the Question Mark, Matching One or More with the Plus, Matching One or More with the Plus, Greedy and Nongreedy Matching

  matching, Matching Multiple Groups with the Pipe, Optional Matching with the Question Mark, Optional Matching with the Question Mark, Matching One or More with the Plus, Matching One or More with the Plus, Greedy and Nongreedy Matching

  greedy, Matching One or More with the Plus

  nongreedy, Greedy and Nongreedy Matching

  one or more, Optional Matching with the Question Mark

  optional, Matching Multiple Groups with the Pipe

  specific reptitions, Matching One or More with the Plus

  zero or more, Optional Matching with the Question Mark

  using parentheses, Review of Regular Expression Matching

  using pipe character in, Grouping with Parentheses

  Guess the Number program, Exception Handling

  GUI (graphical user interface) automation, Controlling the Keyboard and Mouse with GUI Automation, Controlling the Keyboard and Mouse with GUI Automation, Controlling the Keyboard and Mouse with GUI Automation, Controlling the Keyboard and Mouse with GUI Automation, Pauses and Fail-Safes, Moving the Mouse, Step 3: Get and Print the Mouse Coordinates, Clicking the Mouse, Clicking the Mouse, Dragging the Mouse, Scrolling the Mouse, Project: Extending the mouseNow Program, Image Recognition, Image Recognition, Sending a String from the Keyboard, Key Names, Pressing and Releasing the Keyboard, Review of the PyAutoGUI Functions

  (see also form filler project)

  controlling keyboard, Image Recognition, Image Recognition, Sending a String from the Keyboard, Key Names, Pressing and Releasing the Keyboard

  hotkey combinations, Pressing and Releasing the Keyboard

  key names, Sending a String from the Keyboard

  pressing and releasing, Key Names

  sending string from keyboard, Image Recognition

 

‹ Prev