Are you over 18 and want to see adult content?
More Annotations
A complete backup of elevateyourart.com
Are you over 18 and want to see adult content?
A complete backup of kreditkarte-kostenlos.de
Are you over 18 and want to see adult content?
A complete backup of goodbouldering.com
Are you over 18 and want to see adult content?
A complete backup of falconrecruitmentandtraining.co.uk
Are you over 18 and want to see adult content?
A complete backup of couchtraveler.com
Are you over 18 and want to see adult content?
A complete backup of savvybookwriters.wordpress.com
Are you over 18 and want to see adult content?
A complete backup of peliculasmas.org
Are you over 18 and want to see adult content?
Favourite Annotations
A complete backup of realmofcaring.org
Are you over 18 and want to see adult content?
A complete backup of trekfanfiction.net
Are you over 18 and want to see adult content?
A complete backup of matthias-heiderich.de
Are you over 18 and want to see adult content?
Text
a
AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 6. MANIPULATING STRINGS. Text is one of the most common forms of data your programs will handle. You already know how to concatenate two string values together with the + operator, but you can do much more than that. You can extract partial strings from string values, add or remove spacing, convert letters AUTOMATE THE BORING STUFF WITH PYTHON Figure 19-3: My cat, Zophie. The camera adds 10 pounds (which is a lot for a cat). If the image file isn’t in the current working directory, change the working directory to the folder that contains the image file by calling the os.chdir() function. >>> import os >>> os.chdir('C:\\folder_with_image_file') The Image.open() function returns a value of the Image object data type, which is how AUTOMATE THE BORING STUFF WITH PYTHON Figure 20-1: The coordinates of a computer screen with 1920×1080 resolution. Your resolution is how many pixels wide and tall your screen is. If your screen’s resolution is set to 1920×1080, then the coordinate for the upper-left corner will be (0, 0), and thecoordinate for
AUTOMATE THE BORING STUFF WITH PYTHON The Unix epoch is a time reference commonly used in programming: 12 AM on January 1, 1970, Coordinated Universal Time (UTC). The time.time() function returns the number of seconds since that moment as a float value. (Recall that a float is just a number with a decimal point.) This number is called an epoch timestamp.For example, enter the following into the interactive shell: AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 0APPENDIX C Udemy Online Video Course. The Automate the Boring Stuff with Python Programming online course on Udemy covers most of the content of the book. If you'd prefer a video format for learning to program, you can use this link to get a 70% discount. You will have lifetime access to the course content and can post questions to the course's forums. AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 20 Chapter 1 – Python Basics. Chapter 2 – Flow Control. Chapter 3 – Functions. Chapter 4 – Lists. Chapter 5 – Dictionaries and Structuring Data. Chapter 6 – Manipulating Strings. Chapter 7 – Pattern Matching with Regular Expressions. Chapter 8 – Input Validation. Chapter 9 – Reading and Writing Files. AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 3. FUNCTIONS. You’re already familiar with the print (), input (), and len () functions from the previous chapters. Python provides several built-in functions like these, but you can also write your own functions. A function is like a miniprogram within a program. To better understand how functions work AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 4. LISTS. One more topic you’ll need to understand before you can begin writing programs in earnest is the list data type and its cousin, the tuple. Lists and tuples can contain multiple values, which makes writing programs that handle large amounts of data easier. AUTOMATE THE BORING STUFF WITH PYTHON The order of operations (also called precedence) of Python math operators is similar to that of mathematics.The ** operator is evaluated first; the *, /, //, and % operators are evaluated next, from left to right; and the + and -operators are evaluated last (also from left to right). You can use parentheses to override the usual precedence if you need to. AUTOMATE THE BORING STUFF WITH PYTHON On Linux, it is in /usr/bin/pip3. While pip comes automatically installed with Python 3.4 on Windows and OS X, you must install it separately on Linux. To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip. To install pip3 on Fedora Linux, enter sudo yum install python3-pip intoa
AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 6. MANIPULATING STRINGS. Text is one of the most common forms of data your programs will handle. You already know how to concatenate two string values together with the + operator, but you can do much more than that. You can extract partial strings from string values, add or remove spacing, convert letters AUTOMATE THE BORING STUFF WITH PYTHON Figure 19-3: My cat, Zophie. The camera adds 10 pounds (which is a lot for a cat). If the image file isn’t in the current working directory, change the working directory to the folder that contains the image file by calling the os.chdir() function. >>> import os >>> os.chdir('C:\\folder_with_image_file') The Image.open() function returns a value of the Image object data type, which is how AUTOMATE THE BORING STUFF WITH PYTHON Figure 20-1: The coordinates of a computer screen with 1920×1080 resolution. Your resolution is how many pixels wide and tall your screen is. If your screen’s resolution is set to 1920×1080, then the coordinate for the upper-left corner will be (0, 0), and thecoordinate for
AUTOMATE THE BORING STUFF WITH PYTHON The Unix epoch is a time reference commonly used in programming: 12 AM on January 1, 1970, Coordinated Universal Time (UTC). The time.time() function returns the number of seconds since that moment as a float value. (Recall that a float is just a number with a decimal point.) This number is called an epoch timestamp.For example, enter the following into the interactive shell: AUTOMATE THE BORING STUFF WITH PYTHON The re.compile() function returns Regex objects.. Raw strings are used so that backslashes do not have to be escaped. The search() method returns Match objects.. The group() method returns strings of the matched text.. Group 0 is the entire match, group 1 covers the first set of parentheses, and group 2 covers the second set of parentheses.. Periods and parentheses can be escaped with a AUTOMATE THE BORING STUFF WITH PYTHON Remember that expressions are just values combined with operators, and they always evaluate down to a single value. A data type is a category for values, and every value belongs to exactly one data type. The most common data types in Python are listed in Table 1-2.The values -2 and 30, for example, are said to be integer values. The integer (or int) data type indicates values that are whole AUTOMATE THE BORING STUFF WITH PYTHON The order of operations (also called precedence) of Python math operators is similar to that of mathematics.The ** operator is evaluated first; the *, /, //, and % operators are evaluated next, from left to right; and the + and -operators are evaluated last (also from left to right). You can use parentheses to override the usual precedence if you need to. AUTOMATE THE BORING STUFF WITH PYTHON When you call the len() function and pass it an argument such as 'Hello', the function call evaluates to the integer value 5, which is the length of the string you passed it.In general, the value that a function call evaluates to is called the return value of the function.. When creating a function using the def statement, you can specify what the return value should be with a return statement. AUTOMATE THE BORING STUFF WITH PYTHON spam = 'black'. The. setdefault () method offers a way to do this in one line of code. The first argument passed to the method is the key to check for, and the second argument is the value to set at that key if the key does not exist. If the key does exist, the. setdefault () method returns the key’s value. AUTOMATE THE BORING STUFF WITH PYTHON Like a list, a dictionary is a collection of many values. But unlike indexes for lists, indexes for dictionaries can use many different data types, not just integers. Indexes for dictionaries are called keys, and a key with its associated value is called a key-value pair.. In code, a dictionary is typed with braces, {} AUTOMATE THE BORING STUFF WITH PYTHON The shutil module provides functions for copying files, as well as entire folders.. Calling shutil.copy(source, destination) will copy the file at the path source to the folder at the path destination. (Both source and destination are strings.) If destination is a filename, it will be used as the new name of the copied file. This function returns a string of the path of the copied file. AUTOMATE THE BORING STUFF WITH PYTHON WARNING. The first edition of this book suggested using the sudo command if you encountered permission errors while running pip: sudo pip install module.This is a bad practice, as it installs modules to the Python installation used by your operating system. AUTOMATE THE BORING STUFF WITH PYTHON Passing a string value representing your regular expression to re.compile() returns a Regex pattern object (or simply, a Regex object).. To create a Regex object that matches the phone number pattern, enter the following into the interactive shell. (Remember that \d means “a digit character” and \d\d\d-\d\d\d-\d\d\d\d is the regular expression for a phone number pattern.) AUTOMATE THE BORING STUFF WITH PYTHON Once you have the domain name and port information for your email provider, create an SMTP object by calling smptlib.SMTP(), passing the domain name as a string argument, and passing the port as an integer argument.The SMTP object represents a connection to an SMTP mail server and has methods for sending emails. For example, the following call creates an SMTP object for connecting to AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 0APPENDIX C Udemy Online Video Course. The Automate the Boring Stuff with Python Programming online course on Udemy covers most of the content of the book. If you'd prefer a video format for learning to program, you can use this link to get a 70% discount. You will have lifetime access to the course content and can post questions to the course's forums. AUTOMATE THE BORING STUFF WITH PYTHON Remember that expressions are just values combined with operators, and they always evaluate down to a single value. A data type is a category for values, and every value belongs to exactly one data type. The most common data types in Python are listed in Table 1-2.The values -2 and 30, for example, are said to be integer values. The integer (or int) data type indicates values that are whole AUTOMATE THE BORING STUFF WITH PYTHON Chapter 1 – Python Basics. Chapter 2 – Flow Control. Chapter 3 – Functions. Chapter 4 – Lists. Chapter 5 – Dictionaries and Structuring Data. Chapter 6 – Manipulating Strings. Chapter 7 – Pattern Matching with Regular Expressions. Chapter 8 – Input Validation. Chapter 9 – Reading and Writing Files. AUTOMATE THE BORING STUFF WITH PYTHON The re.compile() function returns Regex objects.. Raw strings are used so that backslashes do not have to be escaped. The search() method returns Match objects.. The group() method returns strings of the matched text.. Group 0 is the entire match, group 1 covers the first set of parentheses, and group 2 covers the second set of parentheses.. Periods and parentheses can be escaped with a AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 3. FUNCTIONS. You’re already familiar with the print (), input (), and len () functions from the previous chapters. Python provides several built-in functions like these, but you can also write your own functions. A function is like a miniprogram within a program. To better understand how functions work AUTOMATE THE BORING STUFF WITH PYTHON You have now created a new PDF file that combines the pages from meetingminutes.pdf and meetingminutes2.pdf into a single document. Remember that the File object passed to PyPDF2.PdfFileReader() needs to be opened in read-binary mode by passing 'rb' as the second argument to open().Likewise, the File object passed to PyPDF2.PdfFileWriter() needs to be opened in write-binary AUTOMATE THE BORING STUFF WITH PYTHON spam = 'black'. The. setdefault () method offers a way to do this in one line of code. The first argument passed to the method is the key to check for, and the second argument is the value to set at that key if the key does not exist. If the key does exist, the. setdefault () method returns the key’s value. AUTOMATE THE BORING STUFF WITH PYTHON On Linux, it is in /usr/bin/pip3. While pip comes automatically installed with Python 3.4 on Windows and OS X, you must install it separately on Linux. To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip. To install pip3 on Fedora Linux, enter sudo yum install python3-pip intoa
AUTOMATE THE BORING STUFF WITH PYTHON Figure 20-1: The coordinates of a computer screen with 1920×1080 resolution. Your resolution is how many pixels wide and tall your screen is. If your screen’s resolution is set to 1920×1080, then the coordinate for the upper-left corner will be (0, 0), and thecoordinate for
AUTOMATE THE BORING STUFF WITH PYTHON Figure 19-3: My cat, Zophie. The camera adds 10 pounds (which is a lot for a cat). If the image file isn’t in the current working directory, change the working directory to the folder that contains the image file by calling the os.chdir() function. >>> import os >>> os.chdir('C:\\folder_with_image_file') The Image.open() function returns a value of the Image object data type, which is how AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 0APPENDIX C Udemy Online Video Course. The Automate the Boring Stuff with Python Programming online course on Udemy covers most of the content of the book. If you'd prefer a video format for learning to program, you can use this link to get a 70% discount. You will have lifetime access to the course content and can post questions to the course's forums. AUTOMATE THE BORING STUFF WITH PYTHON Remember that expressions are just values combined with operators, and they always evaluate down to a single value. A data type is a category for values, and every value belongs to exactly one data type. The most common data types in Python are listed in Table 1-2.The values -2 and 30, for example, are said to be integer values. The integer (or int) data type indicates values that are whole AUTOMATE THE BORING STUFF WITH PYTHON Chapter 1 – Python Basics. Chapter 2 – Flow Control. Chapter 3 – Functions. Chapter 4 – Lists. Chapter 5 – Dictionaries and Structuring Data. Chapter 6 – Manipulating Strings. Chapter 7 – Pattern Matching with Regular Expressions. Chapter 8 – Input Validation. Chapter 9 – Reading and Writing Files. AUTOMATE THE BORING STUFF WITH PYTHON The re.compile() function returns Regex objects.. Raw strings are used so that backslashes do not have to be escaped. The search() method returns Match objects.. The group() method returns strings of the matched text.. Group 0 is the entire match, group 1 covers the first set of parentheses, and group 2 covers the second set of parentheses.. Periods and parentheses can be escaped with a AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 3. FUNCTIONS. You’re already familiar with the print (), input (), and len () functions from the previous chapters. Python provides several built-in functions like these, but you can also write your own functions. A function is like a miniprogram within a program. To better understand how functions work AUTOMATE THE BORING STUFF WITH PYTHON You have now created a new PDF file that combines the pages from meetingminutes.pdf and meetingminutes2.pdf into a single document. Remember that the File object passed to PyPDF2.PdfFileReader() needs to be opened in read-binary mode by passing 'rb' as the second argument to open().Likewise, the File object passed to PyPDF2.PdfFileWriter() needs to be opened in write-binary AUTOMATE THE BORING STUFF WITH PYTHON spam = 'black'. The. setdefault () method offers a way to do this in one line of code. The first argument passed to the method is the key to check for, and the second argument is the value to set at that key if the key does not exist. If the key does exist, the. setdefault () method returns the key’s value. AUTOMATE THE BORING STUFF WITH PYTHON On Linux, it is in /usr/bin/pip3. While pip comes automatically installed with Python 3.4 on Windows and OS X, you must install it separately on Linux. To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip. To install pip3 on Fedora Linux, enter sudo yum install python3-pip intoa
AUTOMATE THE BORING STUFF WITH PYTHON Figure 20-1: The coordinates of a computer screen with 1920×1080 resolution. Your resolution is how many pixels wide and tall your screen is. If your screen’s resolution is set to 1920×1080, then the coordinate for the upper-left corner will be (0, 0), and thecoordinate for
AUTOMATE THE BORING STUFF WITH PYTHON Figure 19-3: My cat, Zophie. The camera adds 10 pounds (which is a lot for a cat). If the image file isn’t in the current working directory, change the working directory to the folder that contains the image file by calling the os.chdir() function. >>> import os >>> os.chdir('C:\\folder_with_image_file') The Image.open() function returns a value of the Image object data type, which is how AUTOMATE THE BORING STUFF WITH PYTHON The re.compile() function returns Regex objects.. Raw strings are used so that backslashes do not have to be escaped. The search() method returns Match objects.. The group() method returns strings of the matched text.. Group 0 is the entire match, group 1 covers the first set of parentheses, and group 2 covers the second set of parentheses.. Periods and parentheses can be escaped with a AUTOMATE THE BORING STUFF WITH PYTHON First, let’s go over some basic definitions: An Excel spreadsheet document is called a workbook.A single workbook is saved in a file with the .xlsx extension. Each workbook can contain multiple sheets (also called worksheets).The sheet the user is currently viewing (or last viewed before closing Excel) is called the active sheet.. Each sheet has columns (addressed by letters starting at A AUTOMATE THE BORING STUFF WITH PYTHON Figure 10-1: An example folder that contains three folders and four files. Here is an example program that uses the os.walk() function on the directory tree from Figure 10-1:. import os for folderName, subfolders, filenames in os.walk('C:\\delicious'): AUTOMATE THE BORING STUFF WITH PYTHON The order of operations (also called precedence) of Python math operators is similar to that of mathematics.The ** operator is evaluated first; the *, /, //, and % operators are evaluated next, from left to right; and the + and -operators are evaluated last (also from left to right). You can use parentheses to override the usual precedence if you need to. AUTOMATE THE BORING STUFF WITH PYTHON Like a list, a dictionary is a collection of many values. But unlike indexes for lists, indexes for dictionaries can use many different data types, not just integers. Indexes for dictionaries are called keys, and a key with its associated value is called a key-value pair.. In code, a dictionary is typed with braces, {} AUTOMATE THE BORING STUFF WITH PYTHON Much like HTTP is the protocol used by computers to send web pages across the Internet, Simple Mail Transfer Protocol (SMTP) is the protocol used for sending email. SMTP dictates how email messages should be formatted, encrypted, and relayed between mail servers, and all the other details that your computer handles after you click Send. AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 6. MANIPULATING STRINGS. Text is one of the most common forms of data your programs will handle. You already know how to concatenate two string values together with the + operator, but you can do much more than that. You can extract partial strings from string values, add or remove spacing, convert letters AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 4. LISTS. One more topic you’ll need to understand before you can begin writing programs in earnest is the list data type and its cousin, the tuple. Lists and tuples can contain multiple values, which makes writing programs that handle large amounts of data easier. AUTOMATE THE BORING STUFF WITH PYTHON Creating a PdfFileWriter object creates only a value that represents a PDF document in Python. It doesn’t create the actual PDF file. For that, you must call the PdfFileWriter’s write() method.. The write() method takes a regular File object that has been opened in write-binary mode. You can get such a File object by calling Python’s open() function with two arguments: the string of what AUTOMATE THE BORING STUFF WITH PYTHON Once you have the domain name and port information for your email provider, create an SMTP object by calling smptlib.SMTP(), passing the domain name as a string argument, and passing the port as an integer argument.The SMTP object represents a connection to an SMTP mail server and has methods for sending emails. For example, the following call creates an SMTP object for connecting to AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 0APPENDIX C Udemy Online Video Course. The Automate the Boring Stuff with Python Programming online course on Udemy covers most of the content of the book. If you'd prefer a video format for learning to program, you can use this link to get a 70% discount. You will have lifetime access to the course content and can post questions to the course's forums. AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 20 Chapter 1 – Python Basics. Chapter 2 – Flow Control. Chapter 3 – Functions. Chapter 4 – Lists. Chapter 5 – Dictionaries and Structuring Data. Chapter 6 – Manipulating Strings. Chapter 7 – Pattern Matching with Regular Expressions. Chapter 8 – Input Validation. Chapter 9 – Reading and Writing Files. AUTOMATE THE BORING STUFF WITH PYTHON The re.compile() function returns Regex objects.. Raw strings are used so that backslashes do not have to be escaped. The search() method returns Match objects.. The group() method returns strings of the matched text.. Group 0 is the entire match, group 1 covers the first set of parentheses, and group 2 covers the second set of parentheses.. Periods and parentheses can be escaped with a AUTOMATE THE BORING STUFF WITH PYTHON Remember that expressions are just values combined with operators, and they always evaluate down to a single value. A data type is a category for values, and every value belongs to exactly one data type. The most common data types in Python are listed in Table 1-2.The values -2 and 30, for example, are said to be integer values. The integer (or int) data type indicates values that are whole AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 3. FUNCTIONS. You’re already familiar with the print (), input (), and len () functions from the previous chapters. Python provides several built-in functions like these, but you can also write your own functions. A function is like a miniprogram within a program. To better understand how functions work AUTOMATE THE BORING STUFF WITH PYTHON On Linux, it is in /usr/bin/pip3. While pip comes automatically installed with Python 3.4 on Windows and OS X, you must install it separately on Linux. To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip. To install pip3 on Fedora Linux, enter sudo yum install python3-pip intoa
AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 0APPENDIX C Udemy Online Video Course. The Automate the Boring Stuff with Python Programming online course on Udemy covers most of the content of the book. If you'd prefer a video format for learning to program, you can use this link to get a 70% discount. You will have lifetime access to the course content and can post questions to the course's forums. AUTOMATE THE BORING STUFF WITH PYTHONCHAPTER 20 Chapter 1 – Python Basics. Chapter 2 – Flow Control. Chapter 3 – Functions. Chapter 4 – Lists. Chapter 5 – Dictionaries and Structuring Data. Chapter 6 – Manipulating Strings. Chapter 7 – Pattern Matching with Regular Expressions. Chapter 8 – Input Validation. Chapter 9 – Reading and Writing Files. AUTOMATE THE BORING STUFF WITH PYTHON The re.compile() function returns Regex objects.. Raw strings are used so that backslashes do not have to be escaped. The search() method returns Match objects.. The group() method returns strings of the matched text.. Group 0 is the entire match, group 1 covers the first set of parentheses, and group 2 covers the second set of parentheses.. Periods and parentheses can be escaped with a AUTOMATE THE BORING STUFF WITH PYTHON Remember that expressions are just values combined with operators, and they always evaluate down to a single value. A data type is a category for values, and every value belongs to exactly one data type. The most common data types in Python are listed in Table 1-2.The values -2 and 30, for example, are said to be integer values. The integer (or int) data type indicates values that are whole AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 3. FUNCTIONS. You’re already familiar with the print (), input (), and len () functions from the previous chapters. Python provides several built-in functions like these, but you can also write your own functions. A function is like a miniprogram within a program. To better understand how functions work AUTOMATE THE BORING STUFF WITH PYTHON On Linux, it is in /usr/bin/pip3. While pip comes automatically installed with Python 3.4 on Windows and OS X, you must install it separately on Linux. To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip. To install pip3 on Fedora Linux, enter sudo yum install python3-pip intoa
AUTOMATE THE BORING STUFF WITH PYTHON The re.compile() function returns Regex objects.. Raw strings are used so that backslashes do not have to be escaped. The search() method returns Match objects.. The group() method returns strings of the matched text.. Group 0 is the entire match, group 1 covers the first set of parentheses, and group 2 covers the second set of parentheses.. Periods and parentheses can be escaped with a AUTOMATE THE BORING STUFF WITH PYTHON Remember that expressions are just values combined with operators, and they always evaluate down to a single value. A data type is a category for values, and every value belongs to exactly one data type. The most common data types in Python are listed in Table 1-2.The values -2 and 30, for example, are said to be integer values. The integer (or int) data type indicates values that are whole AUTOMATE THE BORING STUFF WITH PYTHON On Linux, it is in /usr/bin/pip3. While pip comes automatically installed with Python 3.4 on Windows and OS X, you must install it separately on Linux. To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip. To install pip3 on Fedora Linux, enter sudo yum install python3-pip intoa
AUTOMATE THE BORING STUFF WITH PYTHON The order of operations (also called precedence) of Python math operators is similar to that of mathematics.The ** operator is evaluated first; the *, /, //, and % operators are evaluated next, from left to right; and the + and -operators are evaluated last (also from left to right). You can use parentheses to override the usual precedence if you need to. AUTOMATE THE BORING STUFF WITH PYTHON spam = 'black'. The. setdefault () method offers a way to do this in one line of code. The first argument passed to the method is the key to check for, and the second argument is the value to set at that key if the key does not exist. If the key does exist, the. setdefault () method returns the key’s value. AUTOMATE THE BORING STUFF WITH PYTHON When you call the len() function and pass it an argument such as 'Hello', the function call evaluates to the integer value 5, which is the length of the string you passed it.In general, the value that a function call evaluates to is called the return value of the function.. When creating a function using the def statement, you can specify what the return value should be with a return statement. AUTOMATE THE BORING STUFF WITH PYTHON Like a list, a dictionary is a collection of many values. But unlike indexes for lists, indexes for dictionaries can use many different data types, not just integers. Indexes for dictionaries are called keys, and a key with its associated value is called a key-value pair.. In code, a dictionary is typed with braces, {} AUTOMATE THE BORING STUFF WITH PYTHON Automate the Boring Stuff with Python. 6. MANIPULATING STRINGS. Text is one of the most common forms of data your programs will handle. You already know how to concatenate two string values together with the + operator, but you can do much more than that. You can extract partial strings from string values, add or remove spacing, convert letters AUTOMATE THE BORING STUFF WITH PYTHON Passing a string value representing your regular expression to re.compile() returns a Regex pattern object (or simply, a Regex object).. To create a Regex object that matches the phone number pattern, enter the following into the interactive shell. (Remember that \d means “a digit character” and \d\d\d-\d\d\d-\d\d\d\d is the regular expression for a phone number pattern.) AUTOMATE THE BORING STUFF WITH PYTHON WARNING. The first edition of this book suggested using the sudo command if you encountered permission errors while running pip: sudo pip install module.This is a bad practice, as it installs modules to the Python installation used by your operating system. Home | Buy on No Starch Press| Buy on Amazon
| @AlSweigart |
AUTOMATE THE BORING STUFF WITH PYTHON Practical programming for total beginners. Written by Al Sweigart. Free to read under a Creative Commons license.
THE SECOND EDITION IS AVAILABLE ON OCTOBER 29TH! SEE WHAT'S NEW. Use code PREORDER to get 30% off the print book (and get the ebook forfree!)
Buy from Amazon
| Buy print/ebook bundle from the publisherLEARN TO CODE
If you've ever spent hours renaming files or updating hundreds of spreadsheet cells, you know how tedious tasks like these can be. But what if you could have your computer do them for you? In Automate the Boring Stuff with Python, you'll learn how to use Python to write programs that do in minutes what would take you hours to do by hand-no prior programming experience required. Once you've mastered the basics of programming, you'll create Python programs that effortlessly perform useful and impressive feats of automation to: * Search for text in a file or across multiple files * Create, update, move, and rename files and folders * Search the Web and download online content * Update and format data in Excel spreadsheets of any size * Split, merge, watermark, and encrypt PDFs * Send reminder emails and text notifications * Fill out online forms Step-by-step instructions walk you through each program, and practice projects at the end of each chapter challenge you to improve those programs and use your newfound skills to automate similar tasks. Don't spend your time doing work a well-trained monkey could do. Even if you've never written a line of code, you can make your computer do the grunt work. Learn how in Automate the Boring Stuff with Python. UDEMY ONLINE VIDEO COURSE The Automate the Boring Stuff with Python Programmingonline course
on Udemy.com covers most of the content of the book. If you'd prefer a video format for learning to program, you can use the discount codeLOWESTPRICE
to get an 80% discount. You will have lifetime access to the course content and can post questions to the course's forums. YOU CAN SUPPORT THE AUTHOR by electing to pay more. Using the discount codes on this site gives the author a larger share than those who sign up from Udemy's own course search results. Like this book? Writing a review helps get it in front of more people!TABLE OF CONTENTS
* Chapter 0 – Introduction * Chapter 1 – Python Basics * Chapter 2 – Flow Control * Chapter 3 – Functions * Chapter 4 – Lists * Chapter 5 – Dictionaries and Structuring Data * Chapter 6 – Manipulating Strings * Chapter 7 – Pattern Matching with Regular Expressions * Chapter 8 – Reading and Writing Files * Chapter 9 – Organizing Files * Chapter 10 – Debugging * Chapter 11 – Web Scraping * Chapter 12 – Working with Excel Spreadsheets * Chapter 13 – Working with PDF and Word Documents * Chapter 14 – Working with CSV Files and JSON Data * Chapter 15 – Keeping Time, Scheduling Tasks, and LaunchingPrograms
* Chapter 16 – Sending Email and Text Messages * Chapter 17 – Manipulating Images * Chapter 18 – Controlling the Keyboard and Mouse with GUIAutomation
* Appendix A – Installing Third-Party Modules * Appendix B – Running Programs * Appendix C – Answers to the Practice QuestionsADDITIONAL CONTENT
* Download files used in the book * List of CSS Selector Tutorials* List of JSON APIs
* List of Programming Practice Sites * List of Web Comics * Schedulers for Windows, Mac, and Linux * How to Do PyCon (or any tech conference)ABOUT THE AUTHOR
Al Sweigart is a software developer and teaches programming to kids and adults. He has written several books for beginners, including Scratch Programming Playground , Cracking Codes with Python , Invent Your Own Computer Games with Python , and Making Games with Python & Pygame Support the author by purchasing the print/ebook bundle from No Starch Press or separately on Amazon.
Read the author's other Creative Commons licensed Python books.Details
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0