Python编程入门指南:A Byte of Python中文版

需积分: 18 3 下载量 132 浏览量 更新于2024-07-18 收藏 4.08MB PDF 举报
"A Byte of Python 中文版,适合初学者的Python编程参考书,由Swaroop C.H.编写,中文版由Letitbe!翻译,适用于Python 3.0,内容涵盖Python介绍、安装、初步编程等。" 《A Byte of Python》是一本面向Python初学者的编程入门书籍,其内容深入浅出,旨在帮助新手快速掌握Python语言的基础知识。作者Swaroop C.H.以简洁明了的方式讲解Python编程,使得读者能够轻松上手。该书已被翻译成多种语言,中文版由热心的志愿者Letitbe!完成,旨在满足中文读者的学习需求。 书中首先介绍了适合阅读本书的读者群体,包括完全没有编程经验的新手以及需要Python作为工具的计算机专业人士。此外,作者还提到了本书的发展历程,以及如何获取最新版本和提供反馈的途径。书中强调了Python 3.0的重要性和与Perl、Ruby等其他语言的对比,以帮助读者理解选择Python的原因。 在技术层面,本书涵盖了Python的基础知识,如Python的特点,包括其易读性、动态类型和强大的标准库。书中还讨论了为什么Python比Perl和Ruby更适合某些用途,引用了程序员们对这些语言的评价。此外,针对不同操作系统(Linux/BSD、Windows、MacOSX)的Python安装方法也得到了详细阐述,确保读者能够在各自的环境下顺利开始编程。 书中的“最初的步骤”章节引导读者通过交互式解释器开始编程,并推荐了适合Python开发的文本编辑器。读者将学习如何创建源文件,理解Python代码的执行过程,以及如何编写可执行的Python程序。同时,书中还提供了获取帮助的途径,帮助读者在遇到困难时能迅速找到解决方案。 《A Byte of 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