- 博客(12)
- 收藏
- 关注
转载 python中oepen及fileobject初步整理之划水篇
open选项 参考官方文档,很多东西也没有看懂,将自己理解的部分先整理到这里,以后还是要参阅官方文档的。 open (file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 1.file file这里可以是文件的路径(相对路径或绝对路径),也可以是...
2018-09-01 12:07:00
522
转载 插入排序(Insertion Sort)
while 版本 # while版本 origin = [9, 10, 2, 8, 5, 6, 1] nums = [0] + origin length = len(nums) for i in range(2,length): nums[0] = nums[i] j = i - 1 while nums[j] > nums[0]: nu...
2018-08-23 08:44:00
146
转载 冒泡排序和选择排序(bubble sort and selection sort)
Bubble sort Basic Method: import random nums = [random.randint(1,20) for _ in range(10)] #制作一个无序数字列表 print(nums) length = len(nums) for i in range(length - 1): for j in range(length - 1 - i)...
2018-08-18 16:56:00
255
转载 内置函数的整理
持续整理和补充ing Built-in Functions setattr() dir() slice() object() staticmethod() eval() open() exec() filter() super() callable() format() property(...
2018-08-17 16:34:00
138
转载 datetime模块的常用总结
datetime模块 datetime模块提供了一些处理日期和时间的标准库。常用的有 datetime timedelta timezone 构造一个datetime对象 datetime() datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, ...
2018-08-17 15:02:00
204
转载 字典总结
字典 key-value键值对的数据集合 字典的特性: 可变,无序,key不重复 字典的创建 创建一个空字典d = {} 或 d = dict() 使用dict(**kwargs)创建一个字典(**kwargs为name = value形式) 使用dict(iterable, **kwargs)创建一个字典,iterable对象必须为二元结构 dict(mapping, **kwarg...
2018-08-15 15:51:00
159
转载 set总结
set 定义 列表的特性: 可修改 无序 不重复 列表的创建: 1.直接创建; s = {‘a', 1, 'c'} 2.set() 创建一个空set; s = set() 3.set(iterable)创建一个包含可迭代对象元素的set; set = {'abc'} #直接创建 >>> s = {'a', 1, 2, 'b'} >>> ...
2018-08-14 09:27:00
138
转载 bytes和bytearray总结
The core built-in types for manipulating binary data are bytes and bytearray. They are supported by memoryview which uses the buffer protocol to access the memory of other binary objects without...
2018-08-11 13:54:00
751
转载 字符串方法总结
字符串方法总结 字符串的方法,按照我个人的理解,根据功能不同,分为以下几类 切分(split系和partition系) 拼接(join) 大小写转换 排版(center,just系和zfill) 替换及批量替换(replace,strip系和expandtabs) 查找(find系和index系) 判断 格式化(format 和 format_map) 编码 切分 方法 说...
2018-08-11 10:52:00
124
转载 字符串之format整理
format 用法 本文根据官方文档及自己理解整理,只整理出自己可以理解的部分,h因个人水平有限,难免有所错误和纰漏,欢迎批评指正。 格式{ [field_name]["!" conversion] [":" format_spec] } "{" [field_name] ["!" conversion] [":" format_spec] "}" 大括号的内容大概分为两部分,冒号":...
2018-08-09 17:54:00
1169
转载 数据结构之列表
序列 序列的通用操作 列表的特性 列表的创建 列表的增删改查 列表的其他操作 列表的赋值,copy,深copy等 一:序列 在python中,序列(sequence)最基本的数据结构。序列中的每个元素都有编号,称为位置或索引,也有人称为下标。可以按照位置序号获取单个元素,也可以...
2018-08-07 16:41:00
320
转载 linux下pyenv的安装和使用
一:pyenv介绍 项目地址:https://github.com/pyenv/pyenv pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single...
2018-07-28 19:59:00
415
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅