学习Python编程:A Byte of Python

需积分: 9 19 下载量 134 浏览量 更新于2024-07-18 3 收藏 720KB PDF 举报
"A Byte of Python" 是一本由 Swaroop C H 编写的关于 Python 编程语言的书籍,共有110页,全英文。这本书面向编程新手和有经验的程序员,旨在帮助读者学习 Python。 书中介绍了 Python 的各种特性,并以 Creative Commons Attribution-NonCommercial-ShareAlike License 2.0 授权。内容涵盖 Preface、Who This Book Is For、History Lesson、Status of the book、Official Website、License Terms、Feedback 和 Something To Think About 等多个部分,为读者提供了全面的学习指南。 书本的主要章节包括: 1. Introduction:对 Python 语言的简介,以及 Python 的特点。 2. Installing Python:指导 Linux/BSD 用户和 Windows 用户如何安装 Python。 3. First Steps:介绍如何使用 Python 解释器,选择编辑器以及执行源文件的基本步骤。 4. The Basics:讲解 Python 中的字面量常量(如数字和字符串)、变量、标识符命名规则、数据类型(如对象)以及输出的处理。 5. Operators and Expressions:涉及运算符和表达式的基本概念。 书中的内容深入浅出,适合初学者快速上手。例如,第4章 The Basics 中详细阐述了 Python 的基本语法,包括不同类型的数值和字符串,变量的使用规则,以及数据类型的概念。特别是 Python 的对象系统,它展示了 Python 是一种面向对象的语言。此外,还提到了物理行与逻辑行的区别,以及 Python 中至关重要的缩进规则,这是 Python 代码可读性和结构的关键。 通过阅读本书,读者不仅可以理解 Python 的基本语法,还能了解到为什么 Python 能受到众多程序员的青睐,以及与其他语言(如 Perl)相比的优势。书中的反馈和思考问题部分鼓励读者积极参与,增强学习效果。
2013-09-16 上传
this is a book about python. it was written by Swaroop C H.its name is "a byte of python". Table of Contents Preface Who This Book Is For History Lesson Status of the book Official Website License Terms Using the interpreter prompt Choosing an Editor Using a Source File Output How It Works Executable Python programs Getting Help Summary 4. The Basics Literal Constants Numbers Strings Variables Identifier Naming Data Types Objects Output How It Works Logical and Physical Lines Indentation Summary 5. Operators and Expressions Introduction Operators Operator Precedence Order of Evaluation Associativity Expressions Using Expressions Summary 6. Control Flow Introduction The if statement ivUsing the if statement How It Works The while statement Using the while statement The for loop Using the for statement Using the break statement The continue statement Using the continue statement Summary 7. Functions Introduction Defining a Function Function Parameters Using Function Parameters Local Variables Using Local Variables Using the global statement Default Argument Values Using Default Argument Values Keyword Arguments Using Keyword Arguments The return statement Using the literal statement DocStrings Using DocStrings Summary 8. Modules Introduction Using the sys module Byte-compiled .pyc files The from..import statement A module's __name__ Using a module's __name__ Making your own Modules Creating your own Modules from..import The dir() function Using the dir function Summary 9. Data Structures Introduction List Quick introduction to Objects and Classes Using Lists Tuple Using Tuples Tuples and the print statement Dictionary Using Dictionaries Sequences Using Sequences References Objects and References More about Strings String Methods Summary 10. Problem Solving - Writing a Python Script The Problem The Solution First Version Second Version Third Version Fourth Version More Refinements The Software Development Process Summary 11. Object-Oriented Programming Introduction The self Classes Creating a Class object Methods Using Object Methds The __init__ method Using the __init__ method Class and Object Variables Using Class and Object Variables Inheritance Using Inheritance Summary 12. Input/Output Files Using file Pickle Pickling and Unpickling Summary 13. Exceptions Errors Try..Except Handling Exceptions Raising Exceptions How To Raise Exceptions Try..Finally Using Finally Summary 14. The Python Standard Library Introduction The sys module Command Line Arguments More sys The os module Summary 15. More Python Special Methods Single Statement Blocks List Comprehension Using List Comprehensions Receiving Tuples and Lists in Functions Lambda Forms Using Lambda Forms The exec and eval statements The assert statement The repr function Summary 16. What Next? Graphical Software Summary of GUI Tools Explore More Summary A. Free/Libré and Open Source Software (FLOSS) B. About Colophon About the Author C. Revision History Timestamp