Have you ever asked yourself, “How do I do that in Python?” If so, you’ll love this practical collection of the most important Python techniques.
Python How-To includes over 60 detailed answers to questions
…and much more
Python How-To walks you through the most important coding techniques in Python. Whether you’re doing data science, building web applications, or writing admin scripts, you’ll find answers to your “how-to” questions in this book. Inside you’ll find important insights into both Python basics and deep-dive topics to help you skill-up at any stage of your Python career. Author Yong Cui’s clear and practical writing is instantly accessible and makes it easy to take advantage of Python’s versatile tools and libraries. Perfect to be read both from cover to cover, and whenever you need help troubleshooting your code.
About the Technology
Python How-To uses a simple but powerful method to lock in 63 core Python skills. You’ll start with a question, like “How do I find items in a sequence?” Next, you’ll see an example showing the basic solution in crystal-clear code. You’ll then explore interesting variations, such as finding substrings or identifying custom classes. Finally, you’ll practice with a challenge exercise before moving on to the next How-To.
About the Book
This practical guide covers all the language features you’ll need to get up and running with Python. As you go, you’ll explore best practices for writing great Python code. Practical suggestions and engaging graphics make each important technique come to life. Author Yong Cui’s careful cross-referencing reveals how you can reuse features and concepts in different contexts.
What’s Inside
How
…and much more.
About the Reader
For beginning to intermediate Python programmers.
About the Author
Dr. Yong Cui has been working with Python in bioscience for data analysis, machine learning, and tool development for over 15 years.
Table of Contents
1 Developing a pragmatic learning strategy PART 1 - USING BUILT-IN DATA MODELS 2 Processing and formatting strings 3 Using built-in data containers 4 Dealing with sequence data 5 Iterables and iterations PART 2 - DEFINING FUNCTIONS 6 Defining user-friendly functions 7 Using functions beyond the basics PART 3 - DEFINING CLASSES 8 Defining user-friendly classes 9 Using classes beyond the basics PART 4 - MANIPULATING OBJECTS AND FILES 10 Fundamentals of objects 11 Dealing with files PART 5 - SAFEGUARDING THE CODEBASE 12 Logging and exception handling 13 Debugging and testing PART 6 - BUILDING A WEB APP 14 Completing a real project
Over the weekend I read an article "Want to quickly spot idiots? Here are five foolproof red flags".* The very first one was: Beware of anyone who describes themselves as a “proud non-reader of books”.
I imagine my fellow goodreaders would agree with this. Personally, I simply cannot imagine a life without reading. Not only do I love to read for pleasure but I need to constantly read to keep up in my field: software development.
While I find myself constantly having to read to learn I am always quite thrilled when I come upon a technical book that is well-written and organized. Young Cui's book "Python How-To" is just such a book. Nicely, Young Cui himself also states that books are his favorite way to learn. And you can tell as you read through his book that not only does it fill a gap in learning (intermediate level) and is invaluable from a technical/coding perspective but this is a book written by a person who loves books.
This was perfect for me because, while I do have a long background in coding, my main language is C# and I am looking to increase my level of expertise in Python. This book takes me through getting to the intermediate level in order to be ready for more advanced topics in the future.
If you're in a similar situation: you have some exposure to Python but you're not quite ready for advanced topics then I highly recommend this book.
Python is interesting for me as a second language and because it is ubiquitous. I am seasoned developer and last almost 15 years I develop mostly in Java. From time to time in Python. Thus, I don't need to learn programming from scratch. I know most modern concepts, just how to write professional Pythonic code. And unfortunately, my time is really limited. In recent years, I bought a few books about Python. I learned a bit and read some chapters, but most books are less or more the same systematic introduction to next language feature. And because I am used for many years to such programming books, I did not expect anything special. The above approach is a bit boring. But what I can do. Then I encountered this one, and surprise this book is different. The author had similar problem as I am, and Yong Cui decided to write a different book, targeted to intermediate Python developers (my experience in Python is pretty limited). And this book is focused not on encyclopedic enumeration of every Python detail but rather about its practical side and how to write Pythonic code, not to e.g. translate code 1:1 from another language which can be really ineffective.
No, no he even compares how person without proper experience could write some snippet and how it should look like. I think that this is precious knowledge. Many parts are written from a point of view of someone who wants to understand how to achieve something in Python. How to use certain syntax but from practical point of view, from point of view of someone like myself. The programmer who read Python code and has some questions, going to ask why use this or that or how someone more experienced implement something.
The book is not plain how to as title suggests, but great introduction to language feautures .
This makes a world of difference and make that book is not boring and there is meat inside. I enjoy it and appreciate authors effort and ideas.
Every chapter contains discussions and challenges which could be used to learn contents of the chapter in practice.
All in all I can highly recommend a book to anyone with clear concience, I wil return to this book with pleasure.
Great book for learning the how and why of a wide range of Python topics.
This book is all about synthesizing domain-independent Python knowledge. The book covers not just advanced features of Python but also basics and fundamental computer programming concepts where relevant. The focus is on synthesizing, as explained in the following subsection.
The book also covers/teaches clean code, like readability, maintainability, and the DRY principle. The book also covers time and space complexity, where to use tuples, namedtuples, lists, dicts, and sets. What I like about the book is that it not only covers "how" but also "why." It goes into detail to a level that is enough to understand but not too deep—for instance, understanding the difference between tuples and lists, as well as knowing when to use map and list comprehension. At the end of each chapter, there is a challenge if you want to practice more.
The book starts with strings and slowly moves to more advanced topics like iterators and iterables, containers, functions, classes, objects, files, debugging, testing, etc. Chapter six introduces typing and how to write good docstrings. Chapter seven covers lambda, and decorators. Chapter eight covers __init__, self, private, protected, and public, __repr__ and __str__, and inheritance. Chapter ten covers __new__, object reference count, coping and destructing objects. Chapter thirteen covers debugging and testing. Testing is using unittest, so you don't need to install pytest. Chapter fourteen is about how to build a web application using a local database using SQLite. In appendixes, book covers how to deal with virtual environments, packages (pip), REPL, VS Code, Jupyter Notebook, Version Control (git) All examples in the book use Python 3.10.
I found this book to be quite enjoyable. It applies to developers of all levels, from beginners to advanced.
This book provides an overview of the Python programming language at a beginner to intermediate level. It would be advisable for people who are learning from scratch to read a more basic book before starting with this one. I liked the author's treatment of the learning context for someone who is still in the early stages of their journey with Python, I think it is very helpful, especially for those who are considering learning on their own. In this sense, some relationships with web development frameworks, data science and machine learning libraries are shown. This can serve as a guide to establish ramifications and new training paths for the reader. In short, it is a book that I would for example feel confident recommending to my undergraduate computer science students, and to anyone who has a grasp of the fundamental syntax and usage of Python and wants to progress to something more advanced.
Although I am not a junior developer any more, I like reading general books, targeted for junior developers and finding some gems in them, that increase my overal programming capacity! :) Especially in the "How-To" books, I always find interesting pieces, that make me a better a developer.
The "Python How-To: ..." book is for developers, who have somehow skipped the best practices and/or have worked in a team, that is really not into implementing them. (Trust me, there are plenty of such teams, I am somehow always part of these). So, such a developer would get what they desire from the book - a structure in their knowledge and a few recipies for understanding the idea, behind Python and programming in general. That's why I go with 5 stars.
Pretty much all of my own personal projects are coded in Python, and I code on them pretty much daily.
This was a great book to help improve my own personal projects with some neat techniques. A lot of them I already know, but a few were good to re-iterate.