Hello! Python
معرفی کتاب «Hello! Python» نوشتهٔ Anthony S. Briggs، منتشرشده توسط نشر Manning Publications Co. LLC در سال 2012. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Hello! Python» در دستهٔ بدون دستهبندی قرار دارد.
**Summary** __Hello! Python__ fully covers the building blocks of Python programming and gives you a gentle introduction to more advanced topics such as object-oriented programming, functional programming, network programming, and program design. New (or nearly new) programmers will learn most of what they need to know to start using Python immediately. **About this Book**Programmers love Python because it's fast and efficient. Shouldn't learning Python be just the same? Hello! Python starts quickly and simply, with a line of Python code. You'll learn the basics the right way--by writing your own programs. Along the way, you'll get a gentle introduction to more advanced concepts and new programming styles.> No experience with Python needed. Exposure to another programming language is helpful but not required. Purchase includes free PDF, ePub, and Kindle eBooks downloadable at manning.com. **What Makes Hello! Python special** * **Learn Python fast** Even if you've never written a line of code before, you'll be writing real Python apps in just an hour or two. * **Great examples** There's something new in every chapter, including games, web programming with Django, databases, and more. * **User Friendly guides** Using lots of illustrations and a down-to-earth writing style, this book invites you to explore Python along with half-a-dozen traveling companions from the User Friendly cartoon strip. ========================================== **Table of Contents**1. Why Python? 2. Hunt the Wumpus 3. Interacting with theWorld 4. Getting Organized 5. Business-Oriented Programming 6. Classes and Object-oriented Programming 7. Sufficiently Advanced Technology 8. Django! 9. Gaming with Pyglet 10. Twisted Networking 11. Django Revisted! 12. Where to from Here? Hello! Python 1 Brief contents 6 Contents 8 Foreword 16 Preface 18 Acknowledgments 20 About this book 22 Roadmap 23 Code downloads and conventions 25 Author Online 25 About the author 25 About Hello! books 26 1 Why Python? 28 Learning to program 29 Telling a computer what to do 30 Programming is made of ideas 32 Programming is design 32 What makes Python so great? 34 Python is easy 34 Python is a real language 35 Python has “batteries included” 35 Python has a large community 36 Setting up Python for Windows 36 Installing Python 36 Running Python programs on Windows 39 Running Python programs from the command line 41 Linux 45 Installing under Linux 45 Linux GUI 45 Linux command line 47 Macintosh 48 Updating the shell profile 48 Setting the default application 49 Troubleshooting 50 A syntax error 51 An incorrect file extension (Windows) 51 Python is installed in a different place (Linux) 51 Text editors and IDEs 51 Summary 53 2 Hunt the Wumpus 55 What’s a program? 56 Writing to the screen 57 Remembering things with variables 58 Asking the player what to do 59 Making decisions 59 Loops 61 Functions 62 Your first program 63 The first version of Hunt the Wumpus 64 Debugging 66 Experimenting with your program 67 More (or fewer) caves 67 A nicer wumpus 67 More than one wumpus 68 Making the caves 68 Lists 69 For loops 71 Coding your caves 71 Fixing a more subtle bug 74 The problem 74 The solution 75 Coding connected caves 75 Clean up your code with functions! 78 Function basics 78 Variable scope 80 Shared state 81 Fixing the wumpus 82 Interacting with the caves 83 Creating the caves 84 Interacting with the player 86 The rest of the program 87 Bows and arrows 89 More atmosphere 92 Where to from here? 95 Bats and pits 95 Making the wumpus move 95 Different cave structures 96 Summary 96 3 Interacting with the world 97 “Batteries included”: Python’s libraries 98 Python’s standard library 99 Other libraries 99 Using libraries 99 What’s in a library, anyway? 101 Another way to ask questions 104 Using command-line arguments 104 Using the sys module 105 Reading and writing files 106 Paths and directories (a.k.a. dude, where’s my file?) 106 Paths 108 File, open! 109 Comparing files 110 Fingerprinting a file 110 Mugshots: storing your files’ fingerprints in a dictionary 112 Putting it all together 113 Testing your program 118 Improving your script 120 Putting results in order 120 Comparing directories 122 Where to from here? 124 Summary 125 4 Getting organized 126 Planning: specifying your program 127 How do you know your program works? 128 Testing manually—boring! 128 Functional testing 129 Unit testing: make the computer do it 129 Test-Driven Development 129 Writing the program 130 Making your tests pass 132 Putting your program together 134 Testing user interfaces 134 What do you do with your input? 136 Running commands 137 Running your program 140 Taking stock 141 What to do next? 142 I’m very busy and important 145 List comprehensions 146 Oops, a bug! 149 Saving your work 154 Editing and deleting 158 A quick fix 158 Deleting to-dos 161 Editing to-dos 164 Where to from here? 167 A help command 167 Undo 168 Different interface 168 Time management and estimation 168 Study one of the unit-testing frameworks 169 Summary 169 5 Business-oriented programming 170 Making programs talk to each other 171 CSV to the rescue! 172 Other formats 173 Getting started 174 Installing Beautiful Soup 175 Installing Firefox and Firebug 175 Examining the page 176 Downloading the page with Python 177 Chopping out the bit you need 179 Adding extra information 180 Caveats for web scraping 183 Writing out to a CSV file 183 Emailing the CSV file 186 Email structure 186 Creating an email 187 Sending email 189 Other email modules 190 A simple script—what could possibly go wrong? 191 No internet 192 Invalid data 192 Data you haven’t thought of 192 Unable to write data 193 No mail server 193 You don't have to fix them 193 How to deal with breaking scripts 193 Communication 194 Tolerance of failure 194 Don’t break in the first place 195 Fail early and loudly 195 Belt and braces 196 Stress and performance testing 196 Try again later 196 Exceptions 199 Why use exceptions? 199 What it means when your program goes “bang!” 200 Catching errors 203 The traceback module 205 Where to from here? 206 Summary 206 6 Classes and object-oriented programming 208 What exactly are classes? 209 Classes contain data 209 They’re a type of their own 209 How do they work? 209 Your first class 210 Object-oriented design 213 Player input 216 First steps: verbing nouns 216 Treasure! 220 Where should your methods go? 220 Finding the treasure 222 Picking up the treasure 223 Further into the caves 226 Here there be monsters! 232 Creating your monsters 232 Some object-oriented design tips 234 Tying it all together 236 Danger and excitement 239 Where to from here? 242 Add more monsters and treasure 242 Extend combat and items 243 Add more adventure 243 Experiment with verbs and nouns 243 Investigate some more advanced features of classes 243 Summary 244 7 Sufficiently advanced technology... 245 Object orientation 246 Mixin classes 246 super() and friends 249 Customizing classes 250 __getattr__ 250 __setattr__ 251 __getattribute__ 252 Properties 254 Emulating other types 256 Generators and iterators 260 Iterators 260 Generators 262 Generator expressions 263 Using generators 264 Reading files 264 Getting to grips with your log lines 268 Pulling out the bits 269 Functional programming 273 Side effects 274 Map and filter 274 Passing and returning functions 275 Where to from here? 278 Summary 278 8 Django! 280 Writing web-based applications with Django 281 Installing Django 282 Setting up Django 282 Writing your application 287 The simplest possible todo list 287 Using a template 288 Using a model 291 Setting up the database 291 Creating a model 292 Django’s admin module 294 Adding an admin interface 296 Making use of your data 298 Using the model 298 Setting up your URLs 301 Submitting forms 304 Handling individual todos 307 Final polishing 312 Where to from here? 313 Summary 314 9 Gaming with Pyglet 315 Installing Pyglet 316 First steps 318 Starship piloting 101 320 Making things happen 322 Back to school: Newton’s first law (and vectors) 325 Gravity 328 Calculating gravity 329 Watch out for that planet! 332 Guns, guns, guns! 335 Evil aliens 338 Where to from here? 344 Extending the game play 344 Altering the game play 344 Refactoring 345 Get feedback 345 Summary 345 10 Twisted networking 347 Installing Twisted 347 Your first application 348 First steps with your MUD 353 Making the game more fun 359 Bad monster! 359 Back to the chat server 362 Making your life easier 367 Exploring unfamiliar code 367 Putting it all together 369 Write your own state machine 374 Making your world permanent 379 Where to from here? 383 Summary 384 11 Django revisited! 385 Authentication 385 Logging in 386 Adding users 390 Listing only your own todos 391 Fixing your database 391 Back on track... 394 Covering all your bases 395 Updating your interface 398 Testing! 399 Unit testing 399 Functional testing 400 Running your tests 402 Images and styles 404 Serving media from Django 404 Serving media from another server 406 Last but not least 408 Where to from here? 408 Summary 409 12 Where to from here? 410 Read some more code 411 Python Standard Library 411 Python recipes 411 Open source projects 412 Join the Python community 412 Sign up for some mailing lists 412 Find a local user group 413 Help out an open source project 413 Scratch your own itch 413 Look at more Python libraries 414 Profiling code 414 Logging 414 Subprocess and multiprocessing 415 Better parsing 415 PIL and image processing 415 XML, ElementTree, and JSON 415 Summary 416 Index 418 Symbols 418 A 418 B 418 C 419 D 419 E 420 F 420 G 421 H 421 I 421 J 422 K 422 L 422 M 422 N 422 O 422 P 422 R 424 S 424 T 424 U 425 V 425 W 425 X 425 Z 425 Hello! Python-back 426 Summary Hello! Python fully covers the building blocks of Python programming and gives you a gentle introduction to more advanced topics such as object-oriented programming, functional programming, network programming, and program design. New (or nearly new) programmers will learn most of what they need to know to start using Python immediately. About this Book Programmers love Python because it's fast and efficient. Shouldn't learning Python be just the same? Hello! Python starts quickly and simply, with a line of Python code. You'll learn the basics the right way--by writing your own programs. Along the way, you'll get a gentle introduction to more advanced concepts and new programming styles.> No experience with Python needed. Exposure to another programming language is helpful but not required. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book. What Makes Hello! Python special Learn Python fast Even if you've never written a line of code before, you'll be writing real Python apps in just an hour or two. Great examples There's something new in every chapter, including games, web programming with Django, databases, and more. User Friendly guides Using lots of illustrations and a down-to-earth writing style, this book invites you to explore Python along with half-a-dozen traveling companions from the User Friendly cartoon strip. ========================================== Table of Contents Why Python? Hunt the Wumpus Interacting with theWorld Getting Organized Business-Oriented Programming Classes and Object-oriented Programming Sufficiently Advanced Technology Django! Gaming with Pyglet Twisted Networking Django Revisted! Where to from Here? Hello! Python fully covers the building blocks of Python programming and gives you a gentle introduction to more advanced topics such as object-oriented programming, functional programming, network programming, and program design. New (or nearly new) programmers will learn most of what they need to know to start using Python immediately. About this Book Programmers love Python because it's fast and efficient. Shouldn't learning Python be just the same? Hello! Python starts quickly and simply, with a line of Python code. You'll learn the basics the right wayby writing your own programs. Along the way, you'll get a gentle introduction to more advanced concepts and new programming styles. No experience with Python needed. Exposure to another programming language is helpful but not required. What's Makes Hello! Python special Learn Python fast Even if you've never written a line of code before, you'll be writing real Python apps in just an hour or two. Great examples There's something new in every chapter, including games, web programming with Django, databases, and more. User Friendly guides Using lots of illustrations and a down-to-earth writing style, this book invites you to explore Python along with half-a-dozen travelling companions from the User Friendly cartoon strip. About the Author Anthony Briggs has taught and programmed Python for over a decade. He works for a communications company in Melbourne, Australia
دانلود کتاب Hello! Python
Hello! Python fully covers the building blocks of Python programming and gives you a gentle introduction to more advanced topics such as object-oriented programming, functional programming, network programming, and program design. New (or nearly new) programmers will learn most of what they need to know to start using Python immediately.