Byte of Python学习笔记一

官网地址:http://www.swaroopch.com/notes/Python

一. Python的特点:
1. 简单
2. 易学
3. 免费开源
4. 高级语言
5. 可移植性
6. 解释性的(不需要编译连接直接运行,Python将原代码转换成字节码,然后将字节码翻译成本地机器语言运行)
7. 面向对象(Python支持面向过程编程也支持面向对象编程)
8. 可扩展性
9. 可嵌入性(可以嵌入到C/C++中)
10. 大量的标准库

二. Python的安装
Python2.x 和Python3.x可以同时安装
下载地址:http://www.python.org/download
如果需要直接在cmd窗口运行,则需要将python根目录添加到Path环境变量
验证是否安装成功:在cmd窗口,输入python -V命令,显示python版本,如Python 3.2

三. 第一步
有两种方式运行Python程序:
1. 使用交互式解释器
>>> print("Hello World")
2. 使用源文件
helloworld.py文件
-------------------------------------
#!/usr/bin/python 
#Filename: helloworld.py
print('Hello World') 
-------------------------------------
windows环境:
>python helloworld.py
Linux环境:
$chmod a+x helloworld.py # 赋权限
$./helloworld.py # 执行

tips:
退出IDLE快捷键:ctrl+d
退出命令窗口Python交互环境快捷键:ctrl+z & enter

可以将Python文件拷贝到%Path%目录下,如将helloworld.py拷贝到D:\pythons目录下,D:\pathons目录已加入到Path,将文件名改为helloworld,然后就可以直接在任何地方,直接输入helloworld命令执行

获取帮助信息
>>>help #进入help交互环境,退出按q
>>>help(object)
>>>help('string')
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值