Python 101
معرفی کتاب «Python 101» نوشتهٔ Michael Driscoll، منتشرشده توسط نشر Michael Driscoll در سال 2020. این کتاب در 5 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «Python 101» در دستهٔ بدون دستهبندی قرار دارد.
Learn how to program with Python 3 from beginning to end. Python 101 starts off with the fundamentals of Python and then builds onto what you’ve learned from there. The audience of this book is primarily people who have programmed in the past but want to learn Python. This book covers a fair amount of intermediate level material in addition to the beginner material. Table of Contents About the Technical Reviewers Ethan Furman Martin Breuss Acknowledgments Introduction Part I - The Basics Part II - Intermediate Materials Part III - Tutorials Part IV - Python Packaging and Distribution Target Audience About the Author Conventions Requirements Book Source Code Reader Feedback Errata Part I - The Python Language Chapter 1 - Installing Python Installing on Windows Installing on Mac Installing on Linux Android / iOS Other Operating Systems Other Python Variants Wrapping Up Chapter 2 - Python Editors What About the REPL? Getting Started with IDLE Getting Started with PyCharm Community Edition Getting Started with Wing Personal Getting Started with Visual Studio Code Wrapping Up Chapter 3 - Documenting Your Code What are Comments? Commenting Out Multiline Comments Learning About docstrings Python's Style Guide: PEP8 Tools that can help Wrapping Up Review Questions Chapter 4 - Working with Strings Creating Strings String Methods String Formatting Formatting Strings Using %s (printf-style) Formatting Strings Using .format() Formatting Strings with f-strings String Concatenation String Slicing Wrapping Up Review Questions Chapter 5 - Numeric Types Integers Floats Complex Numbers Numeric Operations Augmented Assignment Wrapping Up Review Questions Chapter 6 - Learning About Lists Creating Lists List Methods List Slicing Copying a List Wrapping Up Review Questions Chapter 7 - Learning About Tuples Creating Tuples Working With Tuples Concatenating Tuples Special Case Tuples Wrapping Up Review Questions Chapter 8 - Learning About Dictionaries Creating Dictionaries Accessing Dictionaries Dictionary Methods Modifying Your Dictionary Deleting Items From Your Dictionary Wrapping Up Review Questions Chapter 9 - Learning About Sets Creating a Set Accessing Set Members Changing Items Adding Items Removing Items Clearing or Deleting a Set Set Operations Wrapping Up Review Questions Chapter 10 - Boolean Operations and None The bool() Function What About None? Wrapping Up Review Questions Chapter 11 - Conditional Statements Comparison Operators Creating a Simple Conditional Branching Conditional Statements Nesting Conditionals Logical Operators Special Operators Wrapping Up Review Questions Chapter 12 - Learning About Loops Creating a for Loop Looping Over a String Looping Over a Dictionary Extracting Multiple Values in a Tuple While Looping Using enumerate with Loops Creating a while Loop Breaking Out of a Loop Using continue Loops and the else Statement Nesting Loops Wrapping Up Review Questions Chapter 13 - Python Comprehensions List Comprehensions Nested List Comprehensions Dictionary Comprehensions Set Comprehensions Wrapping Up Review Questions Chapter 14 - Exception Handling The Most Common Exceptions Handling Exceptions Raising Exceptions Examining the Exception Object Using the finally Statement Using the else Statement Wrapping Up Review Questions Chapter 15 - Working with Files The open() Function Reading Files Reading Binary Files Writing Files Seeking Within a File Appending to Files Catching File Exceptions Wrapping Up Review Questions Chapter 16 - Importing Using import Using from to Import Specific Bits & Pieces Using as to assign a new name Importing Everything Wrapping Up Review Questions Chapter 17 - Functions Creating a Function Calling a Function Passing Arguments Type Hinting Your Arguments Passing Keyword Arguments Required and Default Arguments What are *args and **kwargs? Positional-only Parameters Scope Wrapping Up Review Questions Chapter 18 - Classes Class Creation Figuring Out self Public and Private Methods / Attributes Subclass Creation Polymorphism Making the Class Nicer Wrapping Up Review Questions Part II - Beyond the Basics Chapter 19 - Introspection Using the type() Function Using the dir() Function Getting help() Other Built-in Introspection Tools Wrapping Up Review Questions Chapter 20 - Installing Packages with pip Installing a Package Exploring Command Line Options Installing with requirements.txt Upgrading a Package Checking What's Installed Uninstalling Packages Alternatives to pip Wrapping Up Review Questions Chapter 21 - Python Virtual Environments Python's venv Library The virtualenv Package Other Tools Wrapping Up Review Questions Chapter 22 - Type Checking in Python Pros and Cons of Type Hinting Built-in Type Hinting / Variable Annotation Collection Type Hinting Hinting Values That Could be None Type Hinting Functions What To Do When Things Get Complicated Classes Decorators Aliasing Other Type Hints Type Comments Static Type Checking Wrapping Up Review Questions Chapter 23 - Creating Multiple Threads Pros of Using Threads Cons of Using Threads Creating Threads Subclassing Thread Writing Multiple Files with Threads Wrapping Up Review Questions Chapter 24 - Creating Multiple Processes Pros of Using Processes Cons of Using Processes Creating Processes with multiprocessing Subclassing Process Creating a Process Pool Wrapping Up Review Questions Chapter 25 - Launching Subprocesses with Python The subprocess.run() Function The subprocess.Popen() Class The subprocess.Popen.communicate() Function Reading and Writing with stdin and stdout Wrapping Up Review Questions Chapter 26 - Debugging Your Code with pdb Starting pdb in the REPL Starting pdb on the Command Line Stepping Through Code Adding Breakpoints in pdb Creating a Breakpoint with set_trace() Using the built-in breakpoint() Function Getting Help Wrapping Up Review Questions Chapter 27 - Learning About Decorators Creating a Function Creating a Decorator Applying a Decorator with @ Creating a Decorator for Logging Stacking Decorators Passing Arguments to Decorators Using a Class as a Decorator Python's Built-in Decorators Python Properties Wrapping Up Review Questions Chapter 28 - Assignment Expressions Using Assignment Expressions What You Cannot Do With Assignment Expressions Wrapping Up Review Questions Chapter 29 - Profiling Your Code Learning How to Profile with cProfile Profiling a Python Script with cProfile Working with Profile Data Using pstats Other Profilers Wrapping Up Review Questions Chapter 30 - An Introduction to Testing Using doctest in the Terminal Using doctest in Your Code Using doctest From a Separate File Using unittest For Test Driven Development Wrapping Up Review Questions Chapter 31 - Learning About the Jupyter Notebook Installing The Jupyter Notebook Creating a Notebook Adding Content Adding an Extension Exporting Notebooks to Other Formats Wrapping Up Review Questions Part III - Practical Python Chapter 32 - How to Create a Command-line Application with argparse Parsing Arguments Creating Helpful Messages Adding Aliases Using Mutually Exclusive Arguments Creating a Simple Search Utility Wrapping Up Review Questions Chapter 33 - How to Parse XML Parsing XML with ElementTree Creating XML with ElementTree Editing XML with ElementTree Manipulating XML with lxml Wrapping Up Review Questions Chapter 34 - How to Parse JSON Encoding a JSON String Saving JSON to Disk Decoding a JSON String Loading JSON from Disk Validating JSON with json.tool Wrapping Up Review Questions Chapter 35 - How to Scrape a Website Rules for Web Scraping Preparing to Scrape a Website Scraping a Website Downloading a File Wrapping Up Review Questions Chapter 36 - How to Work with CSV files Reading a CSV File Reading a CSV File with DictReader Writing a CSV File Writing a CSV File with DictWriter Wrapping Up Review Questions Chapter 37 - How to Work with a Database Using sqlite3 Creating a SQLite Database Adding Data to Your Database Searching Your Database Editing Data in Your Database Deleting Data From Your Database Wrapping Up Review Questions Chapter 38 - Working with an Excel Document in Python Python Excel Packages Getting Sheets from a Workbook Reading Cell Data Iterating Over Rows and Columns Writing Excel Spreadsheets Adding and Removing Sheets Adding and Deleting Rows and Columns Wrapping Up Review Questions Chapter 39 - How to Generate a PDF Installing ReportLab Creating a Simple PDF with the Canvas Creating Drawings and Adding Images Using the Canvas Creating Multi-page Documents with PLATYPUS Creating a Table Wrapping Up Review Questions Chapter 40 - How to Create Graphs Installing Matplotlib Creating a Simple Line Chart with PyPlot Creating a Bar Chart Creating a Pie Chart Adding Labels Adding Titles to Plots Creating a Legend Showing Multiple Figures Wrapping Up Review Questions Chapter 41 - How to Work with Images in Python Installing Pillow Opening Images Cropping Images Using Filters Adding Borders Resizing Images Wrapping Up Review Questions Chapter 42 - How to Create a Graphical User Interface Installing wxPython Learning About Event Loops How to Create Widgets How to Lay Out Your Application How to Add Events How to Create an Application Wrapping Up Review Questions Part IV - Distributing Your Code Chapter 43 - How to Create a Python Package Creating a Module Creating a Package Packaging a Project for PyPI Creating Project Files Creating setup.py Generating a Python Wheel Uploading to PyPI Wrapping Up Review Questions Chapter 44 - How to Create an Exe for Windows Installing PyInstaller Creating an Executable for a Command-Line Application Creating an Executable for a GUI Wrapping Up Review Questions Chapter 45 - How to Create an Installer for Windows Installing Inno Setup Creating an Installer Testing Your Installer Wrapping Up Review Questions Chapter 46 - How to Create an ``exe'' for Mac Installing PyInstaller Creating an Executable with PyInstaller Wrapping Up Review Questions Afterword Appendix A - Version Control Version Control Systems Distributed vs Centralized Versioning Common Terminology Python IDE Version Control Support Wrapping Up Appendix B - Version Control with Git Installing Git Configuring Git Creating a Project Ignoring Files Initializing a Repository Checking the Project Status Adding Files to a Repository Committing Files Viewing the Log Changing a File Reverting a File Checking Out Previous Commits Pushing to Github Wrapping Up Review Question Answer Key Chapter 3 - Documenting Your Code Chapter 4 - Working with Strings Chapter 5 - Numeric Types Chapter 6 - Learning About Lists Chapter 7 - Learning About Tuples Chapter 8 - Learning About Dictionaries Chapter 9 - Learning About Sets Chapter 10 - Boolean Operations and None Chapter 11 - Conditional Statements Chapter 12 - Learning About Loops Chapter 13 - Python Comprehensions Chapter 14 - Exception Handling Chapter 15 - Working with Files Chapter 16 - Importing Chapter 17 - Functions Chapter 18 - Classes Chapter 19 - Introspection Chapter 20 - Installing Packages with pip Chapter 21 - Python Virtual Environments Chapter 22 - Type Checking in Python Chapter 23 - Creating Multiple Threads Chapter 24 - Creating Multiple Processes Chapter 25 - Launching Subprocesses with Python Chapter 26 - Debugging Your Code Chapter 27 - Learning About Decorators Chapter 28 - Assignment Expressions Chapter 29 - Profiling Your Code Chapter 30 - An Introduction to Testing Chapter 31 - Learning About the Jupyter Notebook Chapter 32 - How to Create a Command Line Application with argparse Chapter 33 - How to Parse XML Chapter 34 - How to Parse JSON Chapter 35 - How to Scrape a Website Chapter 36 - How to Work with CSV files Chapter 37 - How to Work with a Database Using sqlite Chapter 38 - Working with an Excel Document in Python Chapter 39 - How to Generate a PDF Chapter 40 - How to Create Graphs Chapter 41 - How to Work with Images in Python Chapter 42 - How to Create a Graphical User Interface Chapter 43 - How to Create a Python Package Chapter 44 - How to Create an Exe for Windows Chapter 45 - How to Create an Installer for Windows Chapter 46 - How to Create an ``exe'' for Mac Mike Driscoll takes you on a journey talking to a hall-of-fame list of truly remarkable Python experts. You'll be inspired every time by their passion for the Python language, as they share with you their experiences, contributions, and careers in Python.Key FeaturesHear from these key Python thinkers about the current status of Python, and where it's heading in the futureListen to their close thoughts on significant Python topics, such as Python's role in scientific computing, and machine learningUnderstand the direction of Python, and what needs to change for Python 4Book DescriptionEach of these twenty Python Interviews can inspire and refresh your relationship with Python and the people who make Python what it is today. Let these interviews spark your own creativity, and discover how you also have the ability to make your mark on a thriving tech community. This book invites you to immerse in the Python landscape, and let these remarkable programmers show you how you too can connect and share with Python programmers around the world. Learn from their opinions, enjoy their stories, and use their tech tips. • Brett Cannon - former director of the PSF, Python core developer, led the migration to Python 3. • Steve Holden - tireless Python promoter and former chairman and director of the PSF. • Carol Willing - former director of the PSF and Python core developer, Project Jupyter Steering Council member. • Nick Coghlan - founding member of the PSF's Packaging Working Group and Python core developer. • Jessica McKellar - former director of the PSF and Python activist. • Marc-André Lemburg - Python core developer and founding member of the PSF. • Glyph Lefkowitz - founder of Twisted and fellow of the PSF • Doug Hellmann - fellow of the PSF, creator of the Python Module of the Week blog, Python community member since 1998. • Massimo Di Pierro - fellow of the PSF, data scientist and the inventor of web2py. • Alex Martelli - fellow of the PSF and co-author of Python in a Nutshell. • Barry Warsaw - fellow of the PSF, Python core developer since 1995, and original member of PythonLabs. • Tarek Ziadé - founder of Afpy and author of Expert Python Programming. • Sebastian Raschka - data scientist and author of Python Machine Learning. • Wesley Chun - fellow of the PSF and author of the Core Python Programming books. • Steven Lott - Python blogger and author of Python for Secret Agents. • Oliver Schoenborn - author of Pypubsub and wxPython mailing list contributor. • Al Sweigart - bestselling author of Automate the Boring Stuff with Python and creator of the Python modules Pyperclip and PyAutoGUI. • Luciano Ramalho - fellow of the PSF and the author of Fluent Python. • Mike Bayer - fellow of the PSF, creator of open source libraries including SQLAlchemy. • Jake Vanderplas - data scientist and author of Python Data Science Handbook.What you will learnHow successful programmers thinkThe history of PythonInsights into the minds of the Python core teamTrends in Python programmingWho this book is forPython programmers and students interested in the way that Python is used – past and present – with useful anecdotes. It will also be of interest to those looking to gain insights from top programmers. Mike Driscoll takes you on a journey talking to a hall-of-fame list of truly remarkable Python experts. You'll be inspired every time by their passion for the Python language, as they share with you their experiences, contributions, and careers in Python. About This Book Hear from these key Python thinkers about the current status of Python, and where it's heading in the future Listen to their close thoughts on significant Python topics, such as Python's role in scientific computing, and machine learning Understand the direction of Python, and what needs to change for Python 4 Who This Book Is For Python programmers and students interested in the way that Python is used - past and present - with useful anecdotes. It will also be of interest to those looking to gain insights from top programmers. What You Will Learn How successful programmers think The history of Python Insights into the minds of the Python core team Trends in Python programming In Detail Each of these twenty Python Interviews can inspire and refresh your relationship with Python and the people who make Python what it is today. Let these interviews spark your own creativity, and discover how you also have the ability to make your mark on a thriving tech community. This book invites you to immerse in the Python landscape, and let these remarkable programmers show you how you too can connect and share with Python programmers around the world. Learn from their opinions, enjoy their stories, and use their tech tips. Brett Cannon - former director of the PSF, Python core developer, led the migration to Python 3. Steve Holden - tireless Python promoter and former chairman and director of the PSF. Carol Willing - former director of the PSF and Python core developer, Project Jupyter Steering Council member. Nick Coghlan - founding member of the PSF's Packaging Working Group and Python core developer. Jessica McKellar - former director of the PSF and Python activist. Marc-André Lemburg - Python core developer and founding member of the PSF. Glyph Lefkowitz - founder of Twisted and fellow of the PSF Doug Hellmann - fellow of the PSF, creator of the Python Module of the Week blog, Python community member since 1998. Massimo Di Pierro - fellow of the PSF, data scientist and the inventor of web2py. Alex Martelli - fellow of the PSF and co-author of Python in a Nutshell. Barry Warsaw - fellow of the PSF, Python core developer since 1995, and original member of PythonLabs. Tarek Ziadé - found ... Quickly discover solutions to common problems, learn best practices, and understand everything wxPython has to offer. This book is for anyone wanting to learn more about how to use the wxPython desktop GUI toolkit. It assumes some prior knowledge of Python and a general understanding of wxPython or GUI development, and contains more than 50 recipes covering various tasks and aspects of the toolkit. wxPython Recipes guides you step by step. The book takes you through how to create user interfaces in Python, including adding widgets, changing background images, manipulating dialogs, managing data, and much more. Examples target both Python 2.x and 3.x, and cover both wxPython 3.0 and Phoenix, offering a complete collection of ideas to improve your GUI development. What You'll Learn Work with UI elements such as widgets, buttons, images, boxes, and more Handle data in files and notebooks Implement XML and using XML resources (XRC) Customize the behavior of panels and objects Who This Book Is For People who are already familiar with the Python programming language and also have a basic understanding of wxPython. Readers who understand event loops and the basics of creating user interfaces with another Python UI toolkit, such as Tkinter or PyQt. Quickly discover solutions to common problems, learn best practices, and understand everything wxPython has to offer. This book is for anyone wanting to learn more about how to use the wxPython desktop GUI toolkit. It assumes some prior knowledge of Python and a general understanding of wxPython or GUI development, and contains more than 50 recipes covering various tasks and aspects of the toolkit. wxPython Recipes絩des you step by step. The book takes you through how to create user interfaces in Python, including adding widgets, changing background images, manipulating dialogs, managing data, and much more. Examples target both Python 2.x and 3.x, and cover both wxPython 3.0 and Phoenix, offering a complete collection of ideas to improve your GUI development
دانلود کتاب Python 101