1 / 10
文档名称:

python分享.ppt

格式:ppt   大小:87KB   页数:10页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

python分享.ppt

上传人:mh900965 2018/6/15 文件大小:87 KB

下载得到文件列表

python分享.ppt

相关文档

文档介绍

文档介绍:Pyton 分享

2011/05/01
Outline
概述
Python内建对象类型
代码
概述

/python/ ivepython
2. 参考文档
python分享\diveintopython-- \.chm
3. 代码风格
每行程序以换行符代表结束,如果一行程序太长的话, 可以用“\”符号扩展到下一行
“”“标识注释
返回
Python内建对象类型

>>> import sys
>>> print
2147483647
>>> type()
<type 'int‘>
Python内建对象类型
2. String字符串型


“\”可允许把字符串放于多行

helptext="""this a help you have any quesions. hope so as you."""
“+”号可连接字符串。
“*”号重复字符串,如:‘hello’*5
string[start:end]
\' 单引号
Python内建对象类型
3. List 介绍
>>> li = ["a", "b", "mpilgrim", "z", "example"]
>>> li[0] # list 索引
'a'
>>> li[-1],li[-3]
('example', 'mpilgrim')
>>> li[1:-1]
[‘b’, ‘mpilgrim’, ‘z’] #list 切片
Python内建对象类型
3. Tuple 介绍
 Tuple 没有方法,不可变的LIST
>>> t = ("a", "b", "mpilgrim", "z", "example")
>>> t[0]
'a'
>>> t
('a', 'b', 'mpilgrim', 'z', 'example')
>>> ('new')
Traceback (most recent call last):
File "<pyshell