Cover Page....2
About This eBook....3
Halftitle Page....5
Title Page....7
Copyright Page....8
Contents....10
Preface....16
Chapter by Chapter....16
Additional Features....18
Final Thoughts....18
Learn Enough Scholarships....18
Acknowledgments....20
About the Author....21
Chapter 1. Hello, World!....22
1.1 Introduction to Python....28
1.2 Python in a REPL....34
1.3 Python in a File....36
1.4 Python in a Shell Script....39
1.5 Python in a Web Browser....41
Chapter 2. Strings....61
2.1 String Basics....61
2.2 Concatenation and Interpolation....65
2.3 Printing....72
2.4 Length, Booleans, and Control Flow....74
2.5 Methods....87
2.6 String Iteration....94
Chapter 3. Lists....101
3.1 Splitting....101
3.2 List Access....104
3.3 List Slicing....106
3.4 More List Techniques....110
3.5 List Iteration....117
3.6 Tuples and Sets....121
Chapter 4. Other Native Objects....126
4.1 Math....126
4.2 Times and Datetimes....133
4.3 Regular Expressions....140
4.4 Dictionaries....148
4.5 Application: Unique Words....155
Chapter 5. Functions and Iterators....163
5.1 Function Definitions....163
5.2 Functions in a File....174
5.3 Iterators....184
Chapter 6. Functional Programming....195
6.1 List Comprehensions....196
6.2 List Comprehensions with Conditions....204
6.3 Dictionary Comprehensions....208
6.4 Generator and Set Comprehensions....212
6.5 Other Functional Techniques....214
Chapter 7. Objects and Classes....218
7.1 Defining Classes....218
7.2 Custom Iterators....226
7.3 Inheritance....230
7.4 Derived Classes....234
Chapter 8. Testing and Test-Driven Development....244
8.1 Package Setup....246
8.2 Initial Test Coverage....251
8.3 Red....264
8.4 Green....271
8.5 Refactor....277
Chapter 9. Shell Scripts....289
9.1 Reading from Files....289
9.2 Reading from URLs....300
9.3 DOM Manipulation at the Command Line....306
Chapter 10. A Live Web Application....319
10.1 Setup....320
10.2 Site Pages....328
10.3 Layouts....338
10.4 Template Engine....350
10.5 Palindrome Detector....365
10.6 Conclusion....394
Chapter 11. Data Science....396
11.1 Data Science Setup....397
11.2 Numerical Computations with NumPy....405
11.3 Data Visualization with Matplotlib....418
11.4 Introduction to Data Analysis with pandas....438
11.5 pandas Example: Nobel Laureates....446
11.6 pandas Example: Titanic....467
11.7 Machine Learning with scikit-learn....479
11.8 Further Resources and Conclusion....499
Index....501
Code Snippets....552
Python is one of the most popular programming languages in the world, used for everything from shell scripts to web development to data science. As a result, Python is a great language to learn, but you don't need to learn "everything" to get started, just how to use it efficiently to solve real problems. In Learn Enough Python to Be Dangerous, renowned instructor Michael Hartl teaches the specific concepts, skills, and approaches you need to be professionally productive.
Even if you've never programmed before, Hartl helps you quickly build technical sophistication and master the lore you need to succeed. Hartl introduces Python both as a general-purpose language and as a specialist tool for web development and data science, presenting focused examples and exercises that help you internalize what matters, without wasting time on details pros don't care about. Soon, it'll be like you were born knowing this stuff--and you'll be suddenly, seriously dangerous.
Michael Hartl's Learn Enough Series includes books and video courses that focus on the most important parts of each subject, so you don't have to learn everything to get started--you just have to learn enough to be dangerous and solve technical problems yourself.