rent-now

Rent More, Save More! Use code: ECRENTAL

5% off 1 book, 7% off 2 books, 10% off 3+ books

9780201748840

Python Visual QuickStart Guide

by
  • ISBN13:

    9780201748840

  • ISBN10:

    0201748843

  • Edition: 1st
  • Format: Paperback
  • Copyright: 2001-10-26
  • Publisher: Peachpit Press
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $21.99

Summary

Untitled Named after the Monty Python comedy troupe, Python is an interpreted, open-source, object-oriented programming language. It's also free and runs portably on Windows, Mac OS, Unix, and other operating systems. Python can be used for all manner of programming tasks, from CGI scripts to full-fledged applications. It is gaining popularity among programmers in part because it is easier to read (and hence, debug) than most other programming languages, and it's generally simpler to install, learn, and use. Its line structure forces consistent indentation. Its syntax and semantics make it suitable for simple scripts and large programs. Its flexible data structures and dynamic typing allow you to get a lot done in a few lines. To learn it, you'll need is some basic programming experience and a copy of Python: Visual QuickStart Guide.In patented Visual QuickStart Guide fashion, the book doesn't just tell you how to use Python to develop applications, it shows you, breaking Python into easy-to-digest, step-by-step tasks and providing example code.Python: Visual QuickStart Guideemphasizes the core language and libraries, which are the building blocks for programs. Author Chris Fehily starts with the basics - expressions, statements, numbers, strings - then moves on to lists, dictionaries, functions, and modules before wrapping things up with straightforward discussions of exceptions and classes. Some additional topics covered include:- Object-oriented programming- Working in multiple operating systems- Structuring large programs- Comparing Python to C, Perl, and Java- Handling errors gracefully.

Author Biography

Chris Fehily is a writer and consultant living in San Francisco.

Table of Contents

Introductionp. xi
About Pythonp. xii
About This Bookp. xvi
A Previewp. xviii
Built-In Typesp. xxii
Getting Startedp. 1
Getting Pythonp. 2
Reading Python Documentationp. 5
Opening a Command-Prompt Windowp. 7
Setting Your Pathp. 8
Using Python Environment Variablesp. 11
Running Programs in Interactive Modep. 12
Running Programs in Script Modep. 14
Using IDLEp. 16
Specifying Command-Line Optionsp. 18
Passing Arguments to a Scriptp. 19
Expressions and Statementsp. 21
Documenting Programsp. 22
Naming Variablesp. 24
Creating Expressionsp. 25
Creating Expression Statementsp. 26
Creating Variablesp. 28
Deleting Variablesp. 31
Printing Objectsp. 32
Determining an Object's Identityp. 34
Creating References to the Same Objectp. 35
Determining an Object's Typep. 37
Using Boolean Operatorsp. 41
Using Comparison Operatorsp. 43
Chaining Comparisonsp. 46
Determining the Order of Evaluationp. 47
Summarizing Objectsp. 48
Working with Numbersp. 49
Understanding the Types of Numbersp. 50
Understanding Promotionp. 52
Performing Basic Arithmeticp. 53
Raising a Number to a Powerp. 55
Getting the Remainder of a Divisionp. 56
Getting the Quotient of a Divisionp. 57
Controlling Calculation Orderp. 58
Making Augmented Assignmentsp. 59
Converting Among Number Typesp. 60
Comparing Numbersp. 61
Using Mathematical Functionsp. 62
Using Advanced Mathematical Functionsp. 64
Generating Random Numbersp. 66
Working with Stringsp. 69
Creating a Stringp. 70
Inserting Special Characters into a Stringp. 72
Creating a Unicode Stringp. 74
Finding the Length of a Stringp. 80
Indexing a String (Extracting a Character)p. 81
Slicing a String (Extracting a Substring)p. 82
Concatenating Stringsp. 84
Repeating a Stringp. 86
Using String Methods and Functionsp. 88
Changing String Casep. 89
Testing a Stringp. 91
Trimming and Justifying a Stringp. 94
Searching for Substringsp. 96
Replacing Substringsp. 100
Translating a Stringp. 102
Splitting and Joining Stringsp. 103
Performing List Operations on a Stringp. 105
Converting a Stringp. 106
Comparing Stringsp. 109
Printing Formatted Stringsp. 113
Working with Lists and Tuplesp. 117
Creating a List or Tuplep. 118
Finding the Length of a List or Tuplep. 120
Indexing a List or Tuple (Extracting an Item)p. 121
Slicing a List or Tuple (Extracting a Segment)p. 123
Copying a List or Tuplep. 125
Concatenating Lists or Tuplesp. 128
Repeating a List or Tuplep. 129
Converting a List or Tuplep. 131
Comparing Lists or Tuplesp. 133
Testing List or Tuple Membershipp. 135
Modifying a Listp. 136
Replacing List Itemsp. 137
Counting Matching List Valuesp. 139
Searching a Listp. 140
Adding List Itemsp. 141
Removing List Itemsp. 143
Sorting a Listp. 146
Inserting Items into a Sorted Listp. 147
Defining a Custom List Sort Orderp. 149
Reversing a Listp. 151
Working with Dictionariesp. 153
Using Dictionary Operators and Methodsp. 154
Creating a Dictionaryp. 155
Printing a Dictionaryp. 157
Getting a Value by Using a Keyp. 159
Getting All of a Dictionary's Valuesp. 161
Getting All of a Dictionary's Keysp. 162
Getting All of a Dictionary's Key-Value Pairsp. 163
Determining Whether a Key Existsp. 164
Counting a Dictionary's Key-Value Pairsp. 165
Adding or Replacing a Key-Value Pairp. 166
Removing a Key-Value Pairp. 167
Removing a Random Key-Value Pairp. 168
Clearing or Deleting a Dictionaryp. 169
Combining Dictionariesp. 170
Copying a Dictionaryp. 171
Converting a Dictionaryp. 172
Comparing Dictionariesp. 173
Sorting a Dictionaryp. 175
Storing Computed Values in a Dictionaryp. 176
Control Flow Statementsp. 179
Splitting Statements Across Linesp. 180
Creating Compound Statementsp. 182
Using pass to Create a Null Statementp. 183
Indenting Blocks of Statementsp. 184
Putting Multiple Statements on a Linep. 186
Using if Conditionalsp. 187
Using if-else Conditionalsp. 188
Using if-elif-else Conditionalsp. 189
Using while Loopsp. 191
Using while-else Loopsp. 193
Using for Loopsp. 194
Using for-else Loopsp. 198
Looping over a Range of Integersp. 199
Skipping Part of a Loop Iterationp. 202
Exiting a Loopp. 204
Functionsp. 207
Defining a Functionp. 208
Documenting a Functionp. 210
Calling a Functionp. 212
Returning a Value from a Functionp. 214
Returning Multiple Values from a Functionp. 218
Specifying Positional Argumentsp. 219
Specifying Default Parameter Valuesp. 220
Specifying Keyword Argumentsp. 222
Specifying an Arbitrary Number of Positional Argumentsp. 224
Specifying an Arbitrary Number of Keyword Argumentsp. 226
Combining Argument-Passing Techniquesp. 227
Creating Recursive Functionsp. 228
Passing Mutable and Immutable Arguments to Functionsp. 230
Declaring Global Variablesp. 232
Assigning a Function to a Variablep. 234
Using Functional Programming Toolsp. 236
Using lambda Expressions to Create Functionsp. 238
Using apply to Call a Functionp. 240
Using map to Apply a Function to Sequence Itemsp. 242
Using zip to Group Sequence Itemsp. 244
Using filter to Remove Sequence Items Conditionallyp. 245
Using reduce to Reduce a Sequencep. 246
Using List Comprehensions to Create Listsp. 247
Modulesp. 251
Structuring a Modulep. 252
Creating a Modulep. 253
Documenting a Modulep. 255
Loading a Module with importp. 256
Accessing Attributesp. 258
Listing an Object's Attributesp. 260
Manipulating Attributesp. 261
Loading Specific Module Names with fromp. 262
Loading a Module Under a Different Name with asp. 265
Enabling Language Featuresp. 266
Reloading a Module with reloadp. 267
Specifying the Module Search Pathp. 269
Determining Whether a Module Is Running As a Programp. 270
Determining Which Modules Are Loadedp. 272
Understanding Namespacesp. 273
Accessing Namespacesp. 275
Understanding Scoping Rulesp. 278
Nesting Functionsp. 279
Grouping Modules into Packagesp. 281
Terminating a Program Explicitlyp. 282
Running Code Programmaticallyp. 283
Filesp. 285
Opening a Filep. 286
Reading from a Filep. 288
Writing to a Filep. 292
Closing a Filep. 294
Changing Position in a Filep. 295
Truncating a Filep. 297
Getting File Object Informationp. 298
Printing to a Filep. 299
Accessing Standard Input and Output Filesp. 300
Prompting for User Inputp. 304
Using the File Systemp. 305
Accessing Environment Variablesp. 307
Changing the Working Directoryp. 308
Listing Directory Contentsp. 309
Creating a Directoryp. 310
Removing a Directoryp. 311
Renaming a File or Directoryp. 312
Removing a Filep. 313
Getting Path Informationp. 314
Getting File Informationp. 316
Splitting Pathsp. 318
Joining Pathsp. 320
Saving Objects As Filesp. 321
Exceptionsp. 325
Understanding the Exception Hierarchyp. 327
Handling an Exceptionp. 331
Ignoring an Exceptionp. 336
Getting an Exception's Argumentp. 337
Handling All Exceptionsp. 339
Running Code in the Absence of an Exceptionp. 340
Handling Multiple Exceptionsp. 341
Running Mandatory Cleanup Codep. 344
Raising an Exception Explicitlyp. 345
Creating User-Defined Exceptionsp. 346
Making an Assertionp. 349
Classesp. 351
Understanding OOP Terminologyp. 352
Defining a Classp. 353
Documenting a Classp. 354
Accessing Built-In Class Attributesp. 355
Creating an Instancep. 356
Accessing Built-In Instance Attributesp. 357
Creating Class Variablesp. 358
Using Special Methods to Overload Standard Behaviorp. 360
Creating Instance Variables with an Initialization Methodp. 362
Destroying an Instancep. 365
Creating a String Representation of an Instancep. 367
Setting the Truth Value of an Instancep. 369
Comparing Instancesp. 370
Accessing Instance Attributesp. 372
Treating an Instance Like a List or Dictionaryp. 374
Performing Mathematical Operations on Instancesp. 376
Calling an Instancep. 379
Defining and Invoking a Custom Methodp. 380
Deriving New Classes from Existing Classesp. 382
Hiding Private Datap. 385
Determining Class Membershipp. 386
Appendix Ap. 387
Learning Pythonp. 388
Getting Supportp. 389
Editing and Debugging Codep. 391
Programming Resourcesp. 392
Indexp. 395
Table of Contents provided by Syndetics. All Rights Reserved.

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program