
Python课程
Ciel_Bubble
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
01 python 变量 print while for
变量 #string variable = "Python" #int variable = 0 #List variable = ['1','2','3'] #Tuple 一旦定义后,其元素个数是不能再改变的。 variable = ('1','2','3') #dictionary variable = {'key1':'value1','key2':'value2','key3':...原创 2019-02-19 15:26:57 · 142 阅读 · 0 评论 -
02 python 模块 数据类型 编码解码 list dictionary
模块 sys import sys print(sys.path) print(sys.argv) os import os os.system("dir") cmd_res = os.popen("dir").read() print(cmd_res) pyc 数据类型 1.int 在Python中整型数据超过边界后不会报错,类型会变为long(python2.7之前版本),但...原创 2019-02-21 11:54:31 · 292 阅读 · 0 评论 -
05 Python Dictionary
info = {'keys1':'value1', 'keys2':'value2', 'keys3':'value3'} dictionary是无序的 Key必须唯一 dic也可以多层嵌套 catalog = { 'A_Project': {'A_Folder': ['a_class1', 'a_class2'], ...原创 2019-03-14 15:07:24 · 520 阅读 · 0 评论 -
07 Python 文件操作,encode,函数
Set https://blog.csdn.net/qq_29756987/article/details/88667360 文件操作 1.在使用open时,因为Python的默认编码格式为GB2132,所以需要转换为相对应的编码格式,否则有可能会报错。 f = open("python.txt", encoding="uft-8")# 文件句柄 f.read() 2.不同变量记录同一个句...原创 2019-03-21 15:37:59 · 543 阅读 · 0 评论 -
08 Python 装饰器(嵌套函数+高阶函数)
装饰器 定义:本质上是函数(装饰其他函数),为其他函数添加附加功能 原则: 1.不能修改被装饰的函数的源代码 2.不能修改被装饰的函数的调用方法原创 2019-04-01 16:58:55 · 401 阅读 · 0 评论 -
09 Python列表生成式 生成器
列表生成式 array = [i*2 for i in range(10)] =>[0, 2, 4, 6, 8, 10, 12, 14, 16, 18] #假设func存在 [ func(i) for i in range(10)] 生成器 通过列表生成式,可以直接创建一个列表。由于内存的限制,列表的容量有限。如果列表元素过多,会占用很多的空间,如果仅仅只需要个别列表元素,那么后...原创 2019-04-18 21:06:46 · 156 阅读 · 0 评论 -
10 迭代器
迭代器 可以直接作用于for循环的数据类型有以下几种: 1.集合数据类型(list,tuple,set,str等) 2.generator,包括生成器和带yield的generator function 这些可以直接作用于for循环的对象统称为可迭代对象(可循环对象):Iterable。可以使用isinstance()判断一个对象是否是Iterable对象。 ...原创 2019-04-19 15:51:42 · 125 阅读 · 0 评论 -
11内置方法
https://docs.python.org/3/library/functions.html?highlight=built#ascii abs() delatter() hash() memoryview() set() all() dict() help() min() setattr() any() dir() hex() next() slice() ...原创 2019-05-06 16:27:59 · 129 阅读 · 0 评论