Python入门指南:A Byte of Python

需积分: 9 6 下载量 127 浏览量 更新于2024-07-19 收藏 609KB PDF 举报
"A Byte of Python.pdf 是一本Python的基础入门英文版书籍,作者Swaroop CH,适合初学者阅读。本书介绍了Python语言的主要特性和使用方法,并提供了安装指南、初步编程步骤等内容。" 《A Byte of Python》是针对Python编程初学者的一本经典教程,书中详细阐述了Python语言的基本概念和语法,旨在帮助读者轻松入门。作者Swaroop CH在2013年5月发布了这本书,旨在让不同背景的读者,无论是学术研究者还是对编程感兴趣的人都能从中受益。 书中的章节涵盖了多个方面: 1. 开篇介绍了本书的目标读者群体,包括学术课程的学生和对编程感兴趣的人,以及书籍的许可协议,允许自由阅读和分发。此外,读者还可以在官方网上阅读或购买纸质版。 2. 前言部分明确了本书的定位,面向所有想要学习Python的人,书中还简述了Python的历史,以及当前版本的状态。作者鼓励读者思考Python为何成为一个流行的选择。 3. 引言部分详细列举了Python语言的特性,如简洁性、易学性、免费开源、高级语言、跨平台、解释执行、面向对象、可扩展和嵌入等。同时,书中提到了Python 2与Python 3的区别,以及程序员对Python的看法。 4. 安装章节指导读者如何在Windows、MacOS X和Linux等不同操作系统上安装Python环境,包括如何运行Python命令行和选择合适的文本编辑器。 5. 首次尝试编程部分介绍了如何使用Python解释器进行交互式编程,选择合适的代码编辑器,以及如何编写并执行源代码文件,这是Python编程的基础。 这本书不仅适合完全的编程新手,也适合有一定经验但希望了解Python语言特性的开发者。通过深入浅出的讲解和实例,读者可以逐步掌握Python编程的基础,为进一步的学习和实践打下坚实的基础。
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