Beställningsvara. Skickas inom 7-10 vardagar. Fri frakt för medlemmar vid köp för minst 249 kr.
Beginning Python: Using Python 2.6 and Python 3.1 introduces this open source, portable, interpreted, object-oriented programming language that combines remarkable power with clear syntax. This book enables you to quickly create robust, reliable, and reusable Python applications by teaching the basics so you can quickly develop Web and scientific applications, incorporate databases, and master systems tasks on various operating systems, including Linux, MAC OS, and Windows. You'll get a comprehensive tutorial that guides you from writing simple, basic Python scripts all the way through complex concepts, and also features a reference of the standard modules with examples illustrating how to implement features in the various modules. Plus, the book covers using Python in specific program development domains, such as XML, databases, scientific applications, network programming, and Web development.
James Payne is Editor in Chief of www.developershed.com, a network of high-technology sites that serves millions of unique visitors every month who are seeking tutorials, advice, answers, or articles.
Introduction xxviiPart I: Dipping Your Toe into Python 1Chapter 1: Programming Basics and Strings 3How Programming is Different from Using a Computer 3The First Steps 5Beginning to Use Python — Strings 7Putting Two Strings Together 11Putting Strings Together in Different Ways 12Summary 13Exercises 14Chapter 2: Numbers and Operators 15Different Kinds of Numbers 15Program Files 18Using Numbers 24Summary 28Exercises 29Chapter 3: Variables — Names for Values 31Referring to Data — Using Names for Data 31Using More Built-in Types 34Other Common Sequence Properties 43Summary 47Exercises 48Part II: Python Language and the Standard Library 49Chapter 4: Making Decisions 51Comparing Values — Are They the Same? 51Doing the Opposite — Not Equal 53Comparing Values — Which One Is More? 54Reversing True and False 56Looking for the Results of More Than One Comparison 56Repetition 60Handling Errors 65Summary 67Exercises 69Chapter 5: Functions 71Putting Your Program into Its Own File 71Functions: Grouping Code under a Name 73Layers of Functions 88Summary 89Exercises 90Chapter 6: Classes and Objects 93Thinking About Programming 93Defining a Class 96Summary 107Exercises 108Chapter 7: Organizing Programs 111Modules 112Packages 118Modules and Packages 120Basics of Testing Your Modules and Packages 124Summary 124Exercises 125Chapter 8: Files and Directories 127File Objects 127Paths and Directories 131Exceptions in os 132Summary 142Exercises 142Chapter 9: Other Features of the Language 143Lambda and Filter: Short Anonymous Functions 143Map: Short-Circuiting Loops 144Decisions within Lists — List Comprehension 145Generating Iterators for Loops 146Special String Substitution Using Dictionaries 148Featured Modules 149Summary 156Exercises 156Chapter 10: Building a Module 157Exploring Modules 157Creating Modules and Packages 162Working with Classes 163Finishing Your Modules 166Creating a Whole Module 179Installing Your Modules 183Summary 187Exercises 188Chapter 11: Text Processing 189Why Text Processing Is So Useful 189Navigating the File System with the os Module 192Working with Regular Expressions and the re Module 199Summary 203Exercises 204Part III: Putting Python to Work 205Chapter 12: Testing 207Assertions 208Test Cases and Test Suites 209Test Fixtures 213Putting It All Together with Extreme Programming 216Formal Testing in the Software Life Cycle 224Summary 225Chapter 13: Writing a GUI with Python 227GUI Programming Toolkits for Python 228Tkinter Introduction 229Creating GUI Widgets with Tkinter 229Summary 238Exercises 238Chapter 14: Accessing Databases 239Working with DBM Persistent Dictionaries 240Working with Relational Databases 245Using the Python Database APIs 252Summary 262Exercises 263Chapter 15: Using Python for XML 265What Is XML? 265What Is a Schema/DTD? 268Document Type Definitions 268Schemas 270XPath 272HTML as a Subset of XML 272XML Libraries Available for Python 274What Is SAX? 274Why Use SAX or DOM 275SAX and DOM Parsers Available for Python 276Intro to XSLT 280What Is lxml? 280Element Classes 281Parsing with lxml 283Summary 285Exercises 285Chapter 16: Network Programming 287Understanding Protocols 289Sending Internet E-mail 293Retrieving Internet E-mail 305Socket Programming 314Introduction to Sockets 314Binding to an External Hostname 316Other Topics 332Summary 334Exercises 335Chapter 17: Extension Programming with C 337Extension Module Outline 338Building and Installing Extension Modules 340Passing Parameters from Python to C 342Returning Values from C to Python 345The LAME Project 346The LAME Extension Module 350Using Python Objects from C Code 363Summary 366Exercises 366Chapter 18: Numerical Programming 367Numbers in Python 368Mathematics 374Complex Numbers 378Arrays 380Summary 384Exercises 384Chapter 19: An Introduction to Django 387What Are Frameworks and Why Would I Use One? 388Other Features of Web Frameworks 388Django — How It All Began 389Understanding Django’s Architecture 390Working with Templates 396Using Templates and Views 398Creating a Model: Creating an Application 403Working with Models: Installation 404Summary 405Exercises 406Chapter 20: Web Applications and Web Services 407REST: The Architecture of the Web 408HTTP: Real-World REST 411CGI: Turning Scripts into Web Applications 417HTML Forms’ Limited Vocabulary 422Safety When Accessing Form Values 423Building a Wiki 428Web Services 441REST Web Services 442XML-RPC 456SOAP 465Documenting Your Web Service API 472Choosing a Web Service Standard 478Web Service Etiquette 479Summary 480Exercises 480Chapter 21: Integrating Java with Python 481Scripting within Java Applications 482Comparing Python Implementations 483Installing Jython 483Running Jython 484Running Jython on Your Own 488Packaging Jython-Based Applications 488Integrating Java and Jython 489Testing from Jython 506Embedding the Jython Interpreter 507Handling Differences between C-Python and Jython 510Summary 511Exercises 512Part IV: Appendices 513Appendix A: Answers to the Exercises 515Appendix B: Online Resources 549Appendix C: What’s New in Python 3.1 553Appendix D: Glossary 559Index 569