Wiley_Making_Use_of_Python.pdf
(
3196 KB
)
Pobierz
Making Use of Python
Rashi Gupta
Wiley Publishing, Inc.
Publisher: Robert Ipsen
Editor: Ben Ryan
Managing Editor: Angela Smith
New Media Editor: Brian Snapp
Text Design & Composition: John Wiley Composition Services
Designations used by companies to distinguish their products are often claimed as trade-
marks. In all instances where John Wiley & Sons, Inc., is aware of a claim, the product names
appear in initial capital or
ALL CAPITAL LETTERS
. Readers, however, should contact the appro-
priate companies for more complete information regarding trademarks and registration.
This book is printed on acid-free paper.
∞
Copyright © 2002 by Rashi Gupta. All rights reserved.
Published by Wiley Publishing, Inc., New York.
Published simultaneously in Canada.
No part of this publication may be reproduced, stored in a retrieval system or transmitted
in any form or by any means, electronic, mechanical, photocopying, recording, scanning or
otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copy-
right Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center,
222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4744. Requests to the
Publisher for permission should be addressed to the Permissions Department, John Wiley
& Sons, Inc., 605 Third Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212) 850-6008,
E-Mail: PERMREQ @ WILEY.COM.
This publication is designed to provide accurate and authoritative information in regard to
the subject matter covered. It is sold with the understanding that the publisher is not
engaged in professional services. If professional advice or other expert assistance is required,
the services of a competent professional person should be sought.
Library of Congress Cataloging-in-Publication Data:
ISBN: 0471-21975-4
Wiley also publishes its books in a variety of electronic formats. Some content that appears
in print may not be available in electronic books.
Printed in the United States of America.
10 9 8 7 6 5 4 3 2 1
Contents
Introduction
xi
Scenario
xxiii
Chapter 1
An Introduction to Python
1
Getting Started
1
Understanding Requirements
2
Determine Requirements of the University
2
Obtain Python and Its Documentation
3
Determine the System Requirements
4
Install Python
5
Start Python in Different Execution Modes
7
Summary
12
Chapter 2
Getting Started with Python
13
Getting Started
14
Writing Your First Python Program
14
Comments
15
Python as a Calculator
16
Using Variables in Python
16
Variables
17
Assigning Values to Variables
18
Standard Types
19
Identifiers and Keywords
39
Memory Management
40
Create a Sequence to Store All the Names of the Students
42
Write the Code to Display the Names of the Students
42
v
vi
Contents
Declare a Dictionary of Student Purchases with the
Names of the Students as the Key
43
Write the Code to Display the Student Purchases
43
Save and Execute the Code
43
Verify the Details
44
Summary
44
Chapter 3
Intrinsic Operations and Input/Output
47
Getting Started
48
Using Input/Output Features and Intrinsic Operations
for Data Types in Python
48
Identify the Variables to Be Used
49
Accepting User Input
49
Formatting the Output
50
Introduction to Intrinsic Operations
55
Intrinsic Operations for Numeric Data Types
57
Intrinsic Operations for Strings
60
Intrinsic Operations for Lists and Tuples
66
Write the Code
71
Execute the Code
71
Summary
73
Chapter 4
Programming Basics
75
Getting Started
76
Conditional Operators
76
Order of Precedence of Operators
82
Using Programming Constructs
83
Identify the Control and Loop Statements to Be Used
84
Write the Code
94
Execute the Code
95
Summary
97
Chapter 5
Functions
99
Getting Started
100
Using Functions
100
Functions
101
Scope of Variables
118
Identify the Functions to Be Used
119
Write the Code
119
Execute the Code
121
Summary
122
Chapter 6
Modules
123
Getting Started
124
Using Modules
124
Modules
124
Packages
135
Identify the Modules to Be Used
136
Contents
vii
Write the Code
137
Execute the Code
139
Summary
140
Chapter 7
Files
141
Getting Started
141
Using File Objects
142
Identify the Functions and Methods to Be Used
142
Write the Code to Store Course Details to the File
154
Execute the Code
155
Verify the Solution
155
Summary
156
Chapter 8
Object-Oriented Programming
157
Getting Started
158
Introducing OOP
158
Components of OOP
159
Benefits of OOP
160
Using Classes
161
Identify the Classes to Be Defined
162
Identifying the Class Objects
163
Identifying the Classes to Be Inherited and Their Objects
170
Identify the Methods to Be Overridden
173
Write the Code
182
Execute the Code
189
Summary
190
Chapter 9
Exception Handling
193
Getting Started
193
Handling Exceptions
194
Identify the Type of Error and Where the Error Occurs
196
Identify the Mechanism of Trapping the Exception
200
Identify the Location for the Code for Handling
the Exception to Be Written
209
Write the Code for Handling the Exception
209
Save and Execute the Code
210
Summary
210
Chapter 10
CGI Programming
213
Getting Started
213
Internet Basics
214
World Wide Web
217
Web Browsers
217
Hypertext Transfer Protocol (HTTP)
220
Revising HTML
221
Client-Side versus Server-Side Scripting
227
An Introduction to CGI
229
Plik z chomika:
maniac64
Inne pliki z tego folderu:
Addison_Wesley_Text_Processing_in_Python.pdf
(2596 KB)
Apress_Pro_Android_Python_with_SL4A.pdf
(5132 KB)
Foundations of Python Network Programming.pdf
(20840 KB)
Python Algorithms. Mastering Basic Algorithms in the Python Language (2010).pdf
(5273 KB)
Python_2.1_Bible.pdf
(6680 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
Pliki dostępne do 08.07.2024
Pliki dostępne do 19.01.2025
# ksiazki
► Sonda - Program TVP 1977-89
Zgłoś jeśli
naruszono regulamin