E-Book, Englisch, 100 Seiten
Gerrard Lean Python
1. ed
ISBN: 978-1-4842-2385-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Learn Just Enough Python to Build Useful Tools
E-Book, Englisch, 100 Seiten
ISBN: 978-1-4842-2385-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Learn only the essential aspects of Python without cluttering up your mind with features you may never use. This compact book is not a 'best way to write code' type of book; rather, the author goes over his most-used functions, which are all you need to know as a beginner and some way beyond.Lean Python takes 58 Python methods and functions and whittles them down to 15: as author Paul Gerrard says, 'I haven't found a need for the rest.'
What You'll Learn
Discover lean Python and how to learn just enough to build useful toolsUse Python objects, program structure, I/O, modules and moreHandle errors and exceptions Test your codeAccess the Web; do searching; and persist data
Who This Book Is For
This book is aimed at three categories of reader: The experienced programmer - if you already know a programming language, this book gives you a shortcut to understanding the Python language and some of its design philosophy.
You work in IT and need a programming primer - you might be a tester who needs to have more informed technical discussions with programmers. Working through the examples will help you to appreciate the challenge of good programming.
First-timer - you want a first book on programming that you can assimilate quickly to help you decide whether programming is for you.
Paul Gerrard is a consultant, teacher, author, webmaster, programmer, tester, conference speaker, rowing coach and publisher.
Autoren/Hrsg.
Weitere Infos & Material
1;Contents at a Glance;4
2;Contents;5
3;About the Author;10
4;About the Technical Reviewer;11
5;Preface;12
6;Acknowledgments;19
7;Chapter 1: Getting Started;21
7.1;The Python Interpreter;21
7.1.1;Interactive Mode;21
7.1.2;Command-Line Mode;23
7.2;Coding, Testing and Debugging Python Programs;23
7.3;Comments, Code Blocks, and Indentation;24
7.4;Variables;25
7.4.1;Common Assignment Operations;25
7.4.2;Other Assignment Operations;26
7.4.3;Python Keywords;26
7.4.4;Special Identifiers;27
7.5;Python Modules;28
7.6;Typical Program Structure;28
8;Chapter 2: Python Objects;30
8.1;Object Types;30
8.2;Factory Functions;30
8.3;Numbers;31
8.3.1;Arithmetic Operators;31
8.3.1.1;Other Operators;32
8.3.2;Conversion Functions;32
8.3.3;Boolean Numbers;33
8.3.4;Random Numbers;33
8.4;Sequences: Strings, Lists, and Tuples;33
8.4.1;Sequence Storage and Access;33
8.4.2;Membership;34
8.4.3;Concatenation2;34
8.4.4;Sequence Elements and Slices;35
8.4.5;Sequence Built-In Functions;35
8.5;Strings;35
8.5.1;Assignment;36
8.5.2;Accessing Substrings;36
8.5.3;String Comparison;36
8.5.4;Membership (Searching);37
8.5.5;Special Characters and Escaping;37
8.5.6;Triple Quotes;37
8.5.7;String Formatting;38
8.5.8;String Functions;38
8.6;Lists;39
8.6.1;Creating Lists;39
8.6.2;Updating Lists;40
8.6.3;Indexing;40
8.6.4;Sequence Operations and Functions;41
8.7;Tuples;41
8.7.1;Creating Tuples;41
8.7.2;Sequence Operations and Functions;41
8.8;Dictionaries;41
8.8.1;Creating a Dictionary;42
8.8.2;Updating a Dictionary;42
8.8.3;Dictionary Operations;42
9;Chapter 3: Program Structure;44
9.1;Decision Making;44
9.1.1;The if Statement;44
9.1.2;The pass Statement;45
9.1.3;Types of Test;45
9.2;Loops and Iteration;46
9.2.1;For Statement;47
9.2.2;While Statement;47
9.2.3;Break Statement;48
9.2.4;Continue Statement1;48
9.2.5;List Comprehensions;49
9.3;Using Functions;49
9.3.1;Why Write Functions?;49
9.3.2;What Is a Function?;50
9.3.3;Return Values;51
9.3.4;Calling a Function;51
9.3.5;Named Arguments;52
9.3.6;Variable Scope;52
10;Chapter 4: Input and Output;53
10.1;Displaying Output;53
10.2;Getting User Input;54
10.3;Writing and Reading Files;55
10.3.1;Opening Files;55
10.3.2;Closing Files;56
10.3.3;Reading Files;56
10.3.4;Writing to Files;57
10.3.5;Accessing the File System;58
10.4;Command-Line Arguments;59
11;Chapter 5: Using Modules;60
11.1;Importing Code from a Module;60
11.1.1;Modules Come from the Python Path;60
11.1.2;Creating and Using Your Own Modules;61
12;Chapter 6: Object Orientation1;63
12.1;What Is Object Orientation?;63
12.2;Creating Objects Using Classes;64
13;Chapter 7: Exception and Error Handling;69
13.1;Exceptions and Errors;69
14;Chapter 8: Testing Your Code;73
14.1;Modularizing Code and Testing It1;73
14.2;Test-Driven Development;73
14.3;The unittest Framework;74
14.4;Assertions;77
14.5;More Complex Test Scenarios;77
15;Chapter 9: Accessing the Web1;78
16;Chapter 10: Searching;81
16.1;Searching for Strings;81
16.2;More Complex Searches;81
16.3;Introducing Regular Expressions1;82
16.4;Simple Searches;82
16.5;Using Special Characters;82
16.6;Finding Patterns in Text;84
16.7;Capturing Parentheses;86
16.8;Finding Links in HTML;86
17;Chapter 11: Databases1;88
17.1;SQLite;88
17.1.1;Database Functions;88
17.2;Connecting and Loading Data into SQLite;89
18;Chapter 12: What Next?;92
18.1;Appendices;93
18.1.1;References;93
18.1.1.1;Web1;93
18.1.1.2;Books;93
18.1.1.3;Tools;94
18.1.2;Python Built-In Exceptions Hierarchy2;94
19;Appendix: Further Information;96
19.1;Contacting the Author;96
19.2;Are You Interested in Training?;96
19.2.1;Learning Python (1- or 2-day course);96
19.2.2;Online Training;97
19.2.3;leanpy.com;97
20;Index;98




