自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 收藏
  • 关注

转载 Python 集合set()

创建 # 创建空集合 set()# 创建集合,参数必须为 iterableset(it) set(dict) # 只取dict.keys()作为集合的元素 特性 # 集合特性:无序序列 # 集合特性:可变 # 集合特性:去重 ls = [1, 2, 1] s = set(ls) print(s) # return {1, 2}  内置函数...

2019-09-27 13:36:00 115

转载 Python-100天代码

import turtle turtle.pensize(4) turtle.pencolor('red') turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forwa...

2019-05-08 00:14:00 423

转载 删除Windows启动管理器下的加载项

删除Windows启动管理器下的加载项 环境:Windows7操作系统 工具:cmd命令行工具 操作: > msconfig 系统配置工具 > bededit 启动菜单编辑器,命令行工具 跳出如下内容: Windows 启动管理器 -------------------- 标识符 ...

2019-02-14 13:57:00 1178

转载 windos7操作系统下easyBCD2.3安装Ubuntu18.04.1-desktop-amd64.iso双系统

准备 操作环境:window7操作系统 硬件:我的计算机只有一个硬盘,那么标识则为hd0 工具:easyBCD2.3 镜像:Ubuntu18.04.1-desktop-amd64.iso 操作: 注意:本人操作是将镜像放在C盘(我的磁盘分区顺序第一位,那么该分区标识为hd0,0) 文件位置: 镜像存放在C盘(hd0,0)根目录 解压出init.l...

2019-02-14 10:58:00 215

转载 Numeric Type -- int, float, complex

Numeric Type -- int, float, complex 数字类型分为3类:整数、浮点数和复数;另外布尔是整数的子类 整数: 无精度限制 纯数字的字面量(包括hex、oct、bin的进制数)生成整数 浮点数: 有精度限制,这取决于你运行的机器,获取信息 “sys.float_...

2019-02-10 20:43:00 242

转载 Comparisons

Comparisons 优先级:比较运算符 > 布尔运算符;比较运算符优先级相同 比较可以连续:如 x < y <=z,等价于 x<y and y <= z 八种比较操作: < strictly less than &...

2019-02-10 18:30:00 192

转载 Truth Value Testing

Truth Value Testing 任何对象都可测试真值: 通过关键字‘if'或‘while’的条件形式 通过Boolean 运算的操作数 默认下,对象都是真的,除非对象类型定义以下任一情况: __bool__()方法返回False 当对象被调用时,__len__()方法返回...

2019-02-10 14:26:00 84

转载 Boolean Operations -- and, or, not

Boolean Operations -- and, or, not 布尔运算操作,优先级按升序排序: x or y 如果x为假,那么y,否则x 短路运算符,只有当参数x为False,才计算参数y x and y 如果x为假,...

2019-02-10 13:18:00 199

转载 enumerate函数

enumerate(iterable, start=0)   __next__()方法 # 枚举可迭代对象a a = ['Mary', 'had', 'little'] for i, e in enumerate(a): print(i, e) # 列出枚举对象 seasons = ['Spring', 'Summer', 'Fall', 'Winter...

2019-01-31 16:33:00 87

转载 classmethod函数

# 装饰器函数,表示一个类方法 class C: @classmethod def f(cls, args): # cls参数:类对象参数 print(cls) print(args) C.f('类对象调用类方法') c = C() # 创建实例 c.f('类实例对象调用类方法...

2019-01-31 14:38:00 122

转载 chr函数

# Unicode编码转为对应字符 for i in range(96, 123): print(chr(i)) 更多:   ord() 转载于:https://www.cnblogs.com/ShuComputerProgram/p/10340863.html

2019-01-31 10:34:00 353

转载 callable函数

# 判断对象是否可调用,可调用,即对象后加() s = "abc" ls = [1,2,3] def f(): pass class F(): pass t =(s, ls, f, F) for obj in t: if callable(obj): print(obj, True) else: ...

2019-01-31 10:21:00 134

转载 bytes函数

# source是字符串,则使用str.encode()转换 b = bytes('abc',encoding='utf-8',errors='strict') print(b,b[0]) # bytes对象不可变 try: b[0] = 100 except TypeError as err: print('it is immutable.so...

2019-01-31 10:11:00 231

转载 bytearray函数

bytearray:   类,可变字节数组 b = bytearray("abc", encoding="utf-8", errors="strict") # bytearray是字节数组序列 for c, i in enumerate(b): print(c,i) print(b,b[0]) # 该类形式为 bytearray(b'abc') ...

2019-01-31 09:31:00 383

转载 bool函数

bool类  参数基于“标准真值测试程序(Truth testing procedure)”进行转换  bool 是 Numeric Types(int,float,complex)的子类,它不可派生出子类  Boolean Values:布尔值,布尔类的唯一实例 True/False。 # 参数缺省,或为flase则返回False print(bool()) # 缺省 ...

2019-01-30 20:22:00 190

转载 bin函数

# 转为二进制字符串 # 整数 print(bin(-2)) # 负整数 '-0b10' print(bin(+2)) # 正整数 '0b10' # 非整数必须通过定义__index__()函数实现返回一个整数 更多:   oct函数   hex函数   特殊方法     __index__     __int__ 转载于:https:...

2019-01-30 19:52:00 1031

转载 ascii函数

# 返回可打印的字符串,等价repr()函数 # ascii编码字符 print(ascii('learn python!')) print(ascii(9876543210)) # 非ascii编码字符,转换为\x,\u或\U的Unicode编码 print(ascii("中")) # 中文 print(ascii("β")) # 德文 ...

2019-01-30 19:24:00 295

转载 any函数

# 可迭代对象为空则假 print(any("")) print(any([])) # 任一元素为真则真 print(any([1,2,None])) print(any([1,2,''])) 转载于:https://www.cnblogs.com/ShuComputerProgram/p/10339379.html...

2019-01-30 18:37:00 163

转载 all函数

判断可迭代对象的元素为真(空迭代对象为真) # 可迭代对象为空则真 print(all("")) print(all([])) # 全部元素为真则真,否则为False print(all([1,2,None])) # None为False print(all([1,2,'',3])) # ''空字符串为False # 等价函数 def all(iter...

2019-01-30 18:29:00 127

转载 abs函数

# 返回绝对值 n = [-1, 1.1, 3+4j] for i in n: print(abs(i)) # 如果参数为complex,则返回其模运算结果 转载于:https://www.cnblogs.com/ShuComputerProgram/p/10339302.html...

2019-01-30 18:10:00 129

转载 virtualenv模块使用

开发多个应用:   如A需要jinja2.7开发;如B需要jinja2.6开发。或者C需要Python2.7开发,D需要Python3.5开发 那么解决上述问题就需要使用virtualenv这个模块:   它的作用是:创建“隔离”环境,使项目拥有独立的Python运行环境 下载:(存在:安装Python版本2和3的)   py -2 -m pip install virt...

2019-01-30 15:45:00 125

转载 string模块

# string Moudle """ Data: ascii_letters 大小写字母 ascii_lowercase 小写字母 ascii_uppercase 大写字母 digits 数字0-9 hexdigits ...

2019-01-30 13:06:00 67

转载 字符串替换

# 字符串替换 s = " work hard" print(s.replace('r', '0')) # new replace old print(s.replace('wo', '01')) print(s.replace('d', '0')) # old not in s, return s print(s.replace('r', '0', 1))...

2019-01-30 11:19:00 90

转载 字符串大小写

# 字符串大小写 s = 'learn python3' s = s.upper() # 转换字母,大写 print(s, s.isupper()) # 判断字母,是否为大写 s = s.lower() # 转换字母,小写 print(s, s.islower()) # 判断字母,是否为小写 转载于:https://www.cnblogs.c...

2019-01-30 10:43:00 112

转载 Python3循环中的break、continue语句

break语句用来终止循环语句 如果您使用嵌套循环,break语句将停止执行最深层的循环,并开始执行下一行代码。 def f(): for i in range(10): for j in range(10): # 中断该层循环 print(i,j) if j == 4: ...

2018-11-30 10:26:00 129

转载 实例:雪景艺术绘图

雪景艺术绘图   turtle艺术绘制图形艺术,指利用turtle库画笔创造性绘制绚丽多彩艺术图形的过程   turtle图形艺术效果中隐含着很多随机元素,如随机颜色、尺寸、位置和数量等。在图形艺术绘制中需要引入随机函数库random。常用randint()函数,生成指定范围内的随机数   “雪景”图形艺术背景为黑色,分为上下两个区域,上方是漫天彩色雪花,下方是由远及近的灰色横线...

2018-11-16 22:34:00 311

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除