Librería Portfolio Librería Portfolio

Búsqueda avanzada


0 productos

en total 0,00 €

Año de edición:
48,95 € -10,0% 44,06 €



Want to learn the Python language without slogging your way through how-to manuals? With Head First Python, you'll quickly grasp Python's fundamentals, working with the built-in data structures and functions. Then you'll move on to building your very own webapp, exploring database management, exception handling, and data wrangling. If you're intrigued by what you can do with context managers, decorators, comprehensions, and generators, it's all here. This second edition is a complete learning experience that will help you become a bonafide Python programmer in no time.

Why does this book look so different? Based on the latest research in cognitive science and learning theory, Head First Pythonuses a visually rich format to engage your mind, rather than a text-heavy approach that puts you to sleep. Why waste your time struggling with new concepts? This multi-sensory learning experience is designed for the way your brain really works.

Chapter 1The Basics: Getting Started Quickly
Breaking with Tradition
Jump Right In
Understanding IDLE's Windows
What Happens Next...
Press F5 to Run Your Code
Code Runs Immediately
Executing Code, One Statement at a Time
Functions + Modules = The Standard Library
Batteries Included
Data Structures Come Built-in
Invoking Methods Obtains Results
Deciding When to Run Blocks of Code
What Happened to My Curly Braces?
What "elseö Can You Have with "ifö?
Suites Can Contain Embedded Suites
What We Already Know
Extending Our Program to Do More
What's the Best Approach to Solving This Problem?
Returning to the Python Shell
Experimenting at the Shell
Iterating Over a Sequence of Objects
Iterating a Specific Number of Times
Applying the Outcome of Task #1 to Our Code
Indent Suites with Format...Indent Region
Arranging to Pause Execution
Importation Confusion
Generating Random Integers with Python
Asking the Interpreter for Help
Reviewing Our Experiments
Updating What We Already Know
A Few Lines of Code Do a Lot
Coding a Serious Business Application
Python Code Is Easy to Read
Is Indentation Driving You Crazy?
Asking the Interpreter for Help on a Function
Experimenting with Ranges
Don't Forget to Try the Beer Song Code
Chapter 1's Programs
Chapter 2List Data: Working With Ordered Data
Numbers, Strings... and Objects
"Everything is an Objectö
Meet the Four Built-in Data Structures
Ordered Collections are Mutable/Immutable
An Unordered Data Structure: Dictionary
A Data Structure Which Avoids Duplicates: Set
A List is an Ordered Collection of Objects
Creating Lists Literally
Putting Lists to Work
Use Your Editor When Working on More Than a Few Lines of Code
"Growingö A List At Run-Time
Checking For Membership with "inö
It's Time to Update Our Code
Removing Objects From a List
Popping Objects Off a List
Extending a List with Objects
Inserting an Object Into a List
What About Using Square Brackets?
What Happened to "plistö?
What Happened to "plistö, Continued?
Lists: What We Know
What Looks Like A Copy, Isn't
How To Copy A Data Structure
Square Brackets Are Everywhere
Lists Extend The Square Bracket Notation
Lists Understand Start, Stop, And Step
List Slices In Action
Starting, And Stopping With Lists
Stepping With Lists
Putting Slices To Work On Lists
Putting Slices To Work On Lists, Continued
Which is better? It depends...
Slicing A List Is Non-destructive
Python's "forö Loop Understands Lists
Python's "forö Loop Understands Slices
Marvin's Slices In Detail
Lists: Updating What We Know
What's Wrong With Lists?
When Not To Use Lists
Chapter 2's Programs
Chapter 2's Programs, Continued
Chapter 3Structured Data: Working With Structured Data
A Dictionary Stores Key/Value Pairs
Make Dictionaries Easy to Read
How to Spot a Dictionary in Code
Insertion Order is NOT Maintained
Value Lookup With Square Brackets
Working With Dictionaries At Run-Time
Recap: Displaying Found Vowels (Lists)
How Can A Dictionary Help Here?
Selecting A Frequency Count Data Structure
Updating A Frequency Counter
Updating A Frequency Counter, v2.0
Iterating Over A Dictionary
Iterating Over Keys And Values
Dictionaries: What We Already Know
Iterating Over A Dictionary With "itemsö
Just How Dynamic Are Dictionaries?
Avoiding KeyErrors At Run-Time
Checking For Membership With "inö
Ensuring Initialization Before Use
Substituting "not inö For "inö
Putting The "setdefaultö Method To Work
Aren't Dictionaries (And Lists) Enough?
Sets Don't Allow Duplicates
Creating Sets Efficiently
Taking Advantage Of Set Methods
Union Works By Combining Sets
Difference Tells You What's Not Shared
Intersection Reports On Commonality
Sets: What You Already Know
Making The Case For Tuples
Tuples Are Immutable
Watch Out For Single-Object Tuples
Combining The Built-in Data Structures
Storing A Table Of Data
A Dictionary Containing a Dictionary
A Dictionary of Dictionaries (a.k.a. A Table)
Pretty Printing Complex Data Structures
Visualizing Complex Data Structures
Accessing A Complex Data Structure's Data
Data Is As Complex As You Make It
Chapter 3's Programs (1 of 2)
Chapter 3's Programs (2 of 2)
Chapter 4Code Reuse: Functions & Modules
Reusing Code With Functions
Introducing Functions
What About Type Information?
Naming A Chunk Of Code With "defö
Invoking Your Function
Use IDLE's Editor To Make Changes
What's The Deal With All Those Strings?
Follow Best Practice As Per The PEPs
Functions Can Accept Arguments
Functions Return A Result
Returning One Value
Returning More Than One Value
Recalling The Built-in Data Structures
Use Annotations To Improve Your Docs
Why Use Function Annotations?
Functions: What We Know Already
Making A Generically Useful Function
Creating Another Function, 1 of 3
Creating Another Function, 2 of 3
Creating Another Function, 3 of 3
Specifying Default Values For Arguments
Positional vs. Keyword Assignment
Updating What We Know About Functions
Functions Beget Modules
How Are Modules Found?
Running Python From The Command-Line
Not Found Modules Produce ImportErrors
ImportErrors Occur No Matter The Platform
Getting A Module Into Site-packages
Creating The Required Setup Files
Creating The Distribution File
Distribution Files On UNIX-like OSes
Installing Packages With "pipö
Modules: What We Know Already
Demonstrating Call-By-Value Semantics
Demonstrating Call-By-Reference Semantics
Can I Test For PEP 8 Compliance?
Getting Ready To Check PEP 8 Compliance
Install The Testing Developer Tools
How PEP 8 Compliant Is Our Code?
Understanding The Failure Messages
Confirming PEP 8 Compliance
Chapter 4's Programs
Chapter 5Building a Webapp: Getting Real
Python: What You Already Know
Let's Build Something
What Do We Want Our Webapp To Do?
What Happens On The Web Server?
Let's Install Flask
How Does Flask Work?
Running Your Flask Webapp For The First Time
Here's What Happened (Line-By-Line)
Creating A Flask Webapp Object
Decorating A Function With A URL
Running Your Webapp's Behavior(s)
Exposing Functionality To The Web
Recall What We're Trying To Build
Building The HTML Form
Templates Relate To Web Pages
Rendering Templates From Flask
Displaying The Webapp's HTML Form
Preparing To Run The Template Code
We're Ready For A Test-Run
Understanding HTTP Status Codes
Handling Posted Data
Refining The Edit/Stop/Start/Test Cycle
Accessing HTML Form Data With Flask
Using Request Data In Your Webapp
Producing The Results As HTML
Calculating The Data We Need
Adding A Finishing Touch
Redirect To Avoid Unwanted Errors
Functions Can Have Multiple URLs
Updating What We Know
Preparing Your Webapp For The Cloud
Exploiting Dunder Name Dunder Main
Chapter 5's Programs
Chapter 6Storing & Manipulating Data: Where To Put Your Data
Doing Something With Your Webapp's Data
Python Supports Open, Process, Close
Reading Data From An Existing File
A Better Open, Process, Close: "withö
A Quick Review
View The Log Through Your Webapp
Examine The Raw Data With View Source
It's Time To Escape (Your Data)
Viewing The Entire Log In Your Webapp
Learning More About The Request-object
Logging Specific Web Request Attributes
Log A Single Line Of Delimited Data
One Final Change To Our Logging Code
From Raw Data To Readable Output
Does This Remind You Of Anything?
Use A Dict Of Dicts... Or Something Else?
What's Joined Together Can Be Split Apart
When Should The Conversion Occur?
Processing Data: What We Already Know
Generate Readable Output With HTML
Embed Display Logic In Your Template
Producing Readable Output With Jinja2
The Current State Of Our Webapp Code
Asking Questions Of Your Data
Chapter 6's Code
Chapter 7Using a Database: Putting Python's DB-API To Use
Database-Enabling Your Webapp
Task 1: Install The MySQL Server
Introducing Python's DB-API
Task 2: Install A MySQL Database Driver For Python
Install MySQL-Connector/Python
Task 3: Create Our Webapp's Database & Tables
Decide On A Structure For Your Log Data
Confirm Your Table Is Ready For Data
Task 4: Create Code To Work With Our Webapp's Database And Tables
Storing Data Is Only Half The Battle
How Best To Reuse Your Database Code?
Consider What You're Trying To Reuse
What About That Import?
Consider What You're Trying To Do
You've Seen This Pattern Before
The Bad News Isn't Really All That Bad
Chapter 7's Code
Chapter 8A Little Bit of Class: Abstracting Behavior and State
Hooking Into The "withö Statement
An Object-Oriented Primer
Creating Objects From Classes
Objects Share Behavior But Not State
Doing More With CountFromBy
It's Worth Repeating Ourselves: Objects Share Behavior But Not State
Invoking A Method: Understand The Details
Method Invocation: What Actually Happens
Adding A Method To A Class
Are You Serious About "selfö?
The Importance Of "selfö
Coping With Scoping
Prefix Your Attribute Names With "selfö
Initialise (Attribute) Values Before Use
Dunder Init Initializes Attributes
Initializing Attributes With Dunder Init
Understanding CountFromBy's Representation
Defining CountFromBy's Representation
Providing Sensible Defaults For CountFromBy
Classes: What We Know
Chapter 8's Code
Chapter 9The Context Management Protocol: Hooking Into Python's With Statement
What's The Best Way To Share Our Webapp's Database Code?
Consider What You're Trying To Do, Revisited
Managing Context With Methods
You've Already Seen A Context Manager In Action
Create A New Context Manager Class
Initialise The Class With The Database Config
Perform Set-up With Dunder Enter
Perform Tear-down With Dunder Exit
Reconsidering Your Webapp Code, 1 of 2
Reconsidering Your Webapp Code, 2 of 2
Recalling The "log_requestö Function
Amending The "log_requestö Function
Recalling The "view_the_logö Function
It's Not Just The Code That Changes
Amending The "view_the_logö Function
All That Remains...
Answering The Data Questions
Chapter 9's Code, 1 of 2
Chapter 9's Code, 2 of 2
Chapter 10Function Decorators: Wrapping Functions
Your Webapp is Working well, but...
The Web is Stateless
Your Web Server (Not Your Computer) Runs Your Code
It's Time for a Bit of a Session
Flask's Session Technology Adds State
Dictionary Lookup Retrieves State
Managing Logins with Sessions
Let's do Login
Let's do Logout & Status Checking
Why not Check for False?
Can we now Restrict Access to URLs?
Copy-and-Paste is Rarely a good Idea
Creating a function helps, but...
You've been Using Decorators all Along
Pass a Function to a Function
Invoking a Passed Function
Functions can be Nested inside Functions
Return a Function from a Function
Accepting a list of Arguments
Processing a list of Arguments
Accepting a dictionary of Arguments
Processing a dictionary of Arguments
Accepting any Number and type of Function Arguments
A Recipe for Creating a Function Decorator
Recap: We need to Restrict Access to Certain URLs
Creating a Function Decorator
The Final Step: Handling Arguments
Your decorator in all its Glory
Putting your decorator to Work
The Beauty of Decorators
Creating more Decorators
Back to Restricting Access to /viewlog
What's Next?
Chapter 10's Code, 1 of 2
Chapter 10's Code, 2 of 2
Chapter 11Exception Handling: What to Do When Things Go Wrong
Databases Aren't Always Available
Web Attacks Are A Real Pain
Input-Output Is (Sometimes) Slow
Your Function Calls Can Fail
Considering The Identified Problems
Always Try To Execute Error-prone Code
Catching An Error Is Not Enough
Try Once, But Except Many Times
A Lot Of Things Can Go Wrong
The Catch-All Exception-Handler
Haven't We Just Lost Something?
Learning About Exceptions From "sysö
The Catch-All Exception-Handler, Revisited
Getting Back To Our Webapp Code
Silently Handling Exceptions
Handling Other Database Errors
Does "More Errorsö Mean "More Exceptsö?
Avoid Tightly Coupled Code
The DBcm Module, Revisited
Creating Custom Exceptions
What Else Can Go Wrong With "DBcmö?
Creating More Custom Exceptions
Are Your Database Credentials Correct?
Handling SQLError Is Different
Be Careful With Code Positioning
Raising SQLError
A Quick Recap: Adding Robustness
How To Deal With Wait? It Depends...
Chapter 11's Code, 1 of 3
Chapter 11's Code, 2 of 3
Chapter 11's Code, 3 of 3
Chapter 1211¾ A Little Bit of Threading: Dealing With Waiting
Waiting: What To Do?
How Are You Querying Your Database?
Database Inserts And Selects Are Different
Doing More Than One Thing At Once
Don't Get Bummed Out: Use Threads
First Things First: Don't Panic
Don't Get Bummed Out: Flask Can Help
Is Your Webapp Robust Now?
Chapter 11¾'s Code, 1 of 2
Chapter 11¾'s Code, 2 of 2
Chapter 13Advanced Iteration: Looping Like Crazy
Bahamas Buzzers Have Places To Go
Reading CSV Data As Lists
Reading CSV Data As Dictionaries
Let's Back Up A Little Bit
Stripping, Then Splitting, Your Raw Data
Be Careful When Chaining Method Calls
Transforming Data Into The Format You Need
Transforming Into A Dictionary Of Lists
Let's Do The Basic Conversions
Did You Spot The Pattern In Your Code?
Spotting The Pattern With Lists
Converting Patterns Into Comprehensions
Take A Closer Look At The Comprehension
What's The Big Deal?
Specifying A Dictionary Comprehension
Extend Comprehensions With Filters
Recall What You Set Out To Do
Deal With Complexity The Python Way
Extract A Single Destination's Flight Times
Extract Flight Times For All Destinations
That Feeling You Get...
The Set Comprehension In Action
How To Spot A Comprehension
What About "Tuple Comprehensionsö?
Parentheses Around Code == Generator
Using A Listcomp To Process URLs
Using A Generator To Process URLs
Using A Generator: What Just Happened?
Define What Your Function Needs To Do
Yield To The Power Of Generator Functions
Tracing Your Generator Function, 1 of 2
Tracing Your Generator Function, 2 of 2
Concluding Remarks
One Final Question
Chapter 12's Code
It's Time To Go...
Appendix Installation: Installing Python
Install Python 3 on Windows
Check Python 3 on Windows
Add to Python 3 on Windows
Install Python 3 on Mac OS X (macOS)
Check & Configure Python 3 on Mac OS X
Install Python 3 on Linux
Appendix Pythonanywhere: Deploying Your Webapp
Step 0: A Little Prep
Step 1: Sign-up For PythonAnywhere
Step 2: Upload Your Files To The Cloud
Step 3: Extract And Install Your Code
Step 4: Create A Starter Webapp, 1 of 2
Step 4: Create A Starter Webapp, 2 of 2
Step 5: Configure Your Webapp
Step 5: Take Your Cloud-based Webapp For A Spin!
Appendix Top Ten Things We Didn't Cover: There's Always More To Learn
1. What About Python 2?
2. Virtual Programming Environments
3. More On Object Orientation
4. Formats For Strings And The Like
5. Getting Things Sorted
6. More From The Standard Library
7. Running Your Code Concurrently
8. GUIs With Tkinter (And Fun With Turtles)
9. It's Not Over 'Til It's Tested
10. Debug, Debug, Debug
Appendix Top Ten Projects Not Covered: Even More Tools, Libraries, And Modules
1. Alternatives To >>>
2. Alternatives To IDLE
3. Jupyter Notebook: The Web-Based IDE
4. Doing Data Science
5. Web Development Technologies
6. Working With Web Data
7. More Data Sources
8. Programming Tools
9. Kivy: Our Pick For "Coolest Project Everö
10. Alternative Implementations
Appendix Getting Involved: The Python Community
BDFL: Benevolent Dictator For Life
A Tolerant Community: Respect For Diversity
The Python Podcasts
The Zen Of Python
Which Book Should I Read Next?
Our Favorite Python Books
Appendix Back Cover Content: TOC images
What will you learn from this book?
Why does this book look so different?
Chapter 1 TOC Image
Chapter 2 TOC Image
Chapter 3 TOC Image
Chapter 4 TOC Image
Chapter 5 TOC Image
Chapter 6 TOC Image
Chapter 7 TOC Image
Chapter 8 TOC Image
Chapter 9 TOC Image
Chapter 10 TOC Image
Chapter 11 TOC Image
Chapter 11¾ TOC Image
Chapter 12 TOC Image