Wednesday, October 5, 2011

Head First Python






Table of Contents
Your brain on Python. Here you are trying to learn something, while
here your brain is doing you a favor by making sure the learning doesn’t stick.
Your brain’s thinking, “Better leave room for more important things, like which
wild animals to avoid and whether naked snowboarding is a bad idea.” So how
do you trick your brain into thinking that your life depends on knowing Python?
Intro
Who is this book for? xxiv
We know what you’re thinking xxv
Metacognition xxvii
Bend your brain into submission xxix
Read me xxx
The technical review team xxxii
Acknowledgments xxxiii
What’s to like about Python? 2
Install Python 3 3
Use IDLE to help learn Python 4
Work effectively with IDLE 5
Deal with complex data 6
Create simple Python lists 7
Lists are like arrays 9
Add more data to your list 11
Work with your list data 15
For loops work with lists of any size 16
Store lists within lists 18
Check a list for a list 20
Complex data is hard to process 23
Handle many levels of nested lists 24
Don’t repeat code; create a function 28
Create a function in Python 29
Recursion to the rescue! 31
Your Python Toolbox 32
Everyone loves lists 1
meet python
You’re asking one question: “What makes Python different?”
The short answer is: lots of things. The longer answers starts by stating that there’s
lots that’s familiar, too. Python is a lot like any other general-purpose programming
language, with statements, expressions, operators, functions, modules, methods,
and classes. All the usual stuff, really. And then there’s the other stuff Python provides
that makes the programmer’s life—your life—that little bit easier. You’ll start your tour
of Python by learning about lists. But, before getting to that, there’s another important
question that needs answering…

3. Dealing with errors
It’s simply not enough to process your list data in your code.
You need to be able to get your data into your programs with ease, too. It’s no surprise then that Python makes reading data from files easy. Which is great, until you
consider what can go wrong when interacting with data external to your programs…
and there are lots of things waiting to trip you up! When bad stuff happens, you need a
strategy for getting out of trouble, and one such strategy is to deal with any exceptional situations using Python’s exception handling mechanism showcased in this chapter.
Data is external to your program 74
It’s all lines of text 75
Take a closer look at the data 77
Know your data 79
Know your methods and ask for help 80
Know your data (better) 82
Two very different approaches 83
Add extra logic 84
Handle exceptions 88
Try first, then recover 89
Identify the code to protect 91
Take a pass on the error 93
What about other errors? 96
Add more error-checking code… 97
…Or add another level of exception handling 98
So, which approach is best? 99
You’re done…except for one small thing 101
Be specific with your exceptions 102
Your Python Toolbox 103

4 Persistence: Saving Data to Files 105
5 Comprehending Data: Work That Data! 139
6 Custom Data Objects: Bundling Code with Data 173
7 Web Development: Putting It All Together 213
8 Mobile App Development: Small Devices 255
9 Manage Your Data: Handling Input 293
10 Scaling Your Webapp: Getting Real 351
11 Dealing with Complexity: Data Wrangling 397
i Leftovers: The Top Ten Things (We Didn’t Cover) 435

Another Phyton Books
Download
Another Programming Language Books

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!