2019年7月12日

python文件

摘要: 文件迭代器是最好的读取工具,从文本文件读取文字的最佳方式就是根本不要读取该文件 从文件读取的数据回到脚本是一个字符串。 close是通常选项。调用close会终止外部文件的连接。 文件总是缓冲并且是可查的 写进文件 myfile = open('myfile.txt', 'w') myfile.wr 阅读全文

posted @ 2019-07-12 18:22 幻嘤剑舞 阅读(106) 评论(0) 推荐(0) 编辑

2019年7月11日

python 元组

摘要: 任意对象的有序集合 通过偏移存取 属于不可变序列类型 固定,异构,任意嵌套 对象引用的数组 print((1,2)+(3,4)) (1, 2, 3, 4) print((1,2) 4) (1, 2, 1, 2, 1, 2, 1, 2) t = (1, 2, 3, 4) print(t[0],t[1: 阅读全文

posted @ 2019-07-11 08:10 幻嘤剑舞 阅读(91) 评论(0) 推荐(0) 编辑

2019年7月10日

python 字典

摘要: 无序,通过键值对来存储数据 可嵌套。异构,映射操作 散列表 基本操作 d = {'spam':2,'ham':3,'eggs':4} print(d['spam']) 2 print(len(d)) 3 print('ham' in d) True print(list(d.keys())) ['s 阅读全文

posted @ 2019-07-10 08:46 幻嘤剑舞 阅读(85) 评论(0) 推荐(0) 编辑

2019年7月9日

python 列表

摘要: 任意对象的有序集合 通过偏移读取 可变长度,异构以及嵌套 可变序列 对象引用数组 l = [1,2,3] print(len(l)) 3 print([1,2,4] + [5,6,7]) [1, 2, 4, 5, 6, 7] print(['hi'] 4) ['hi', 'hi', 'hi', 'h 阅读全文

posted @ 2019-07-09 20:33 幻嘤剑舞 阅读(66) 评论(0) 推荐(0) 编辑

2019年7月8日

字符串

摘要: def spliting(): return(' ' 30) print('spa"m') spa"m print("spa'm") spa'm print('''spam''') spam print('spam',"spam") spam spam print('l' 'u''x') lux p 阅读全文

posted @ 2019-07-08 08:20 幻嘤剑舞 阅读(654) 评论(0) 推荐(0) 编辑

2019年7月6日

动态类型

摘要: python 动态类型 阅读全文

posted @ 2019-07-06 08:28 幻嘤剑舞 阅读(140) 评论(0) 推荐(0) 编辑

2019年7月4日

数字类型

摘要: python数字类型 阅读全文

posted @ 2019-07-04 08:28 幻嘤剑舞 阅读(130) 评论(0) 推荐(0) 编辑

2019年7月3日

练习

摘要: def spliting(): print(' ' 60) import math print(math.pi) 3.141592653589793 print(math.sqrt(4)) 2 import random print(random.randint(1,10)) print(rando 阅读全文

posted @ 2019-07-03 13:22 幻嘤剑舞 阅读(90) 评论(0) 推荐(0) 编辑

导航