欢迎来到我的博客园
摘要: python学习[第七篇] 数据类型之 字符串二 对应版本 Python2 术语 ASCII 美国标准信息交换码 UCS 通用字符集 UCS2 UCS的双字节编码方式 UCS4 UCS的四字节编码方式 UTF UNICODE或者UCS的转换格式 UTF-8 8位的UTF转换格式 什么是unicode 阅读全文
posted @ 2018-07-12 16:59 panzq 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 序列定义 序列中的成员是有序排列的,并且可以通过下标偏移量访问到他的一个或者几个成员。 包括:字符串,列表和元组。 序列类型有相同的访问模式,他的每一个元素可以通过指定一个偏移量的方式得到,而多个元素可以通过切片操作的方式一次得到。下标偏移量从0开始到总元素-1. 序列操作符 1 标准类型操作符 对 阅读全文
posted @ 2018-07-07 02:57 panzq 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 定义break变量在最里层修改 break_fllag为True x='Hello {renming},您最喜欢在{nali},您的爱好是{shiqing} ' break_flag=False while not break_flag: name=input('你好,请问如何称呼您?:') if 阅读全文
posted @ 2018-07-07 01:10 panzq 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 数据类型之 字符串一 字符串操作 创建及赋值 x = 'abcde' x = "abcde" x = '''abcde''' x = """abcde""" #通过str方法将其他类型转化为字符串类型 x = str([1234]) 访问字符串 通过索引 和 通过切片访问任意部分字符串 astrin 阅读全文
posted @ 2018-07-06 01:04 panzq 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 数字类型 数字类型分类 python数字类型分五类(整形有3个 浮点型 复数) 整形 标准整形 0101 84 -237 0x80 017 -680 -0x92 布尔型 True False 长整型 (能表达的数值与机器位数有关 ,用大写L表现长整型) 浮点数 0.0 -777.1.6 6.022e 阅读全文
posted @ 2018-07-05 13:19 panzq 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 控制结构 if 语句 # only if block if condition: if_true_block # if_else block if condition: if_true_block else: if_false_block # if_elif_else block if condit 阅读全文
posted @ 2018-07-04 17:33 panzq 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 开发规范 文件名以.py 结束 注意加注释 解释器路径 #!/usr/bin/env/python 编码 # -*- coding='utf-8' -*-#python3 无需关注,python2 出现中文必须加入此注释 python 模块结构和布局 #建议结构如下: #(1) 起始行(解释器 #! 阅读全文
posted @ 2018-07-04 15:46 panzq 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 1 coding 注释在python3可以不加,python2只要出现中文的就必须加 # --coding=utf-8-- print '泡泡' 2整形 python2 有长整型概念, python3没有长整型概念 阅读全文
posted @ 2018-07-04 15:25 panzq 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1缩进错误 IndentationError: unexpected indent ttt1=1 ttt2=2 2 语法错误 SyntaxError: invalid syntax printf 'ffff' SyntaxError: keyword can't be an expression t 阅读全文
posted @ 2018-07-04 12:59 panzq 阅读(565) 评论(0) 推荐(0) 编辑
摘要: 数据类型 string[:None] 等于 string[:] python技巧 利用字典 调用函数 def test1(): print 'test1' def test2(): print 'test2' CMDs={'t1':test1,'t2':test2} for key in CMDs. 阅读全文
posted @ 2018-07-03 17:33 panzq 阅读(84) 评论(0) 推荐(0) 编辑