The name Python comes from the surreal British comedy group Monty Python, not from the snake. Python programmers are affectionately called Pythonistas, and both Monty Python and serpentine references usually pepper Python tutorials and documentation.
. Covers expressions, the most basic type of Python instruction, and how to use the Python interactive shell software to experiment with code.
. Explains how to make programs decide which instructions to execute so your code can intelligently respond to different conditions.
. Instructs you on how to define your own functions so that you can organize your code into more manageable chunks.
. Introduces the list data type and explains how to organize data.
. Introduces the dictionary data type and shows you more powerful ways to organize data.
. Covers working with text data (called strings in Python).
. Covers how Python can manipulate strings and search for text patterns with regular expressions.
. Explains how your programs can read the contents of text files and save information to files on your hard drive.
. Shows how Python can copy, move, rename, and delete large numbers of files much faster than a human user can. It also explains compressing and decompressing files.
. . Shows how to write programs that can automatically download web pages and parse them for information. This is called web scraping.
. Covers programmatically manipulating Excel spreadsheets so that you don’t have to read them. This is helpful when the number of documents you have to analyze is in the hundreds or thousands.
. Covers programmatically reading Word and PDF documents.
. Continues to explain how to programmatically manipulate documents with CSV and JSON files.
. Explains how time and dates are handled by Python programs and how to schedule your computer to perform tasks at certain times. This chapter also shows how your Python programs can launch non-Python programs.
. Explains how to write programs that can send emails and text messages on your behalf.
. Explains how to programmatically manipulate images such as JPEG or PNG files.
. Explains how to programmatically control the mouse and keyboard to automate clicks and keypresses.
When asking programming questions, remember to do the following:
Explain what you are trying to do, not just what you did. This lets your helper know if you are on the wrong track.
Specify the point at which the error happens. Does it occur at the very start of the program or only after you do a certain action?
Copy and paste the entire error message and your code to or .
These websites make it easy to share large amounts of code with people over the Web, without the risk of losing any text formatting. You can then put the URL of the posted code in your email or forum post. For example, here some pieces of code I’ve posted: and .
Explain what you’ve already tried to do to solve your problem. This tells people you’ve already put in some work to figure things out on your own.
List the version of Python you’re using. (There are some key differences between version 2 Python interpreters and version 3 Python interpreters.) Also, say which operating system and version you’re running.
If the error came up after you made a change to your code, explain exactly what you changed.
Say whether you’re able to reproduce the error every time you run the program or whether it happens only after you perform certain actions. Explain what those actions are, if so.
Always follow good online etiquette as well. For example, don’t post your questions in all caps or make unreasonable demands of the people trying to help you.
This book will start you off from zero programming knowledge, but you may have questions beyond its scope. Remember that asking effective questions and knowing how to find answers are invaluable tools on your programming journey.
Let’s begin!