会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
3
4
5
6
7
8
下一页
2020年2月6日
类 深入学习(一)
摘要: 类的成员修饰符 一般情况的类成员为共有成员 如: 而私有成员是如下情况在字段前加两个下划线以及其调用方式创建一个新的方法 且无法直接访问,这能间接访问 上诉为字段的私有成员,方法的私有成员以及父类私有成员的调用如下
阅读全文
posted @ 2020-02-06 17:53 ComeIntoBud
阅读(225)
评论(0)
推荐(0)
2020年2月2日
类 的讲解
摘要: 这是我自己做的一张关于类的基础知识点
阅读全文
posted @ 2020-02-02 17:28 ComeIntoBud
阅读(180)
评论(0)
推荐(0)
2019年12月20日
讲解 json 和 pickle 模块
摘要: 首先是引入json 和 pickle 的原因是 普通的方法支持的数据类型太少 局限性大 比如下面的例子 dit = {'name':'deng1mei','age':'26','sex':'girl'} #创建一个字典dit = str(dit) #将字典字符串化 以方便写入文件# f= open
阅读全文
posted @ 2019-12-20 14:54 ComeIntoBud
阅读(184)
评论(0)
推荐(0)
2019年12月16日
string method 字符串常用方法讲解
摘要: st = 'hello ketty ##$ \*'print(st.count('t'))# 输出‘t’的个数print(st.capitalize()) #Hello ketty 将首字母大写print(st.center(30,'-')) # hello ketty 将st放在30个'_'的中间
阅读全文
posted @ 2019-12-16 21:49 ComeIntoBud
阅读(516)
评论(0)
推荐(0)
config 模块
摘要: import configparser #配置文件config = configparser.ConfigParser()config["DEFAULT"] = {'ServerAliveInterval': '45','Compression': 'yes','CompressionLevel':
阅读全文
posted @ 2019-12-16 20:51 ComeIntoBud
阅读(123)
评论(0)
推荐(0)
2019年12月14日
加减乘除带括号的计算器代码
摘要: 代码如下 1 import re 2 def form_at(string): 3 string = string.replace('++','+') 4 string = string.replace('-+','-') 5 string = string.replace('+-','-') 6
阅读全文
posted @ 2019-12-14 22:47 ComeIntoBud
阅读(304)
评论(0)
推荐(0)
2019年12月6日
正则表达式11个元字符 及 方法讲解
摘要: import re s = 'hello world'a = s.find('h')print(a)p = s.replace('l', 'xx')print(p)b = s.split('w')print(b) ###############################元字符 1:‘ . ’通
阅读全文
posted @ 2019-12-06 19:13 ComeIntoBud
阅读(678)
评论(0)
推荐(0)
2019年11月25日
hashlib 模块的用法
摘要: import hashlib #多用于加密a=hashlib.md5()print(a) #<md5 HASH object @ 0x00000000021CCF90>a.update('i love you dengmei'.encode('utf8'))print(a.hexdigest())
阅读全文
posted @ 2019-11-25 22:31 ComeIntoBud
阅读(200)
评论(0)
推荐(0)
sys model 常见用法
摘要: import sys #与python解释器 交互print(sys.argv) #是一个列表 解释器执行文件名后面可以增加字符串 以列表元素形式添加进去def foo(): print('ok')def voo(): print('gggg boon!')if sys.argv[1]=='deng
阅读全文
posted @ 2019-11-25 21:59 ComeIntoBud
阅读(371)
评论(0)
推荐(0)
2019年11月20日
os 模块 的常用方法讲解
摘要: import osprint(os.getcwd()) #拿到当前文件的目录os.chdir(r'E:\pycharm 5.3 wenjian weizhi ')#改变当前脚本的工作目录 'r'表示原生字符串 表示所有的字符都是单纯的字符串无其他特殊功能或含义如'/n'print(os.getcwd
阅读全文
posted @ 2019-11-20 20:32 ComeIntoBud
阅读(196)
评论(0)
推荐(0)
2019年11月17日
time 模块 和 random 模块常用方法讲解
摘要: import timeprint(help(time))print(time.time())#时间戳 1573991312.5361328print(time.perf_counter())#计算CPU的执行时间结构化时间:print(time.gmtime())#UTC时间 世界标准时间time.
阅读全文
posted @ 2019-11-17 21:58 ComeIntoBud
阅读(175)
评论(0)
推荐(0)
2019年11月15日
迭代器基础
摘要: #生成器都是迭代器 ,迭代器不一定是生成器#list,tuple,sict,string:Iterable(可迭代对象)#什么是迭代器?#满足两个条件:1有iter方法 2有next方法a = [1,2,3,4,]b= a.__iter__()print(b) #<list_iterator obj
阅读全文
posted @ 2019-11-15 22:04 ComeIntoBud
阅读(153)
评论(0)
推荐(0)
yield 伪并发例子
摘要: import timedef custumer(name): print('%s 准备吃饺子了'%name) while True: curry = yield print('饺子%s来了 ,被%s吃了'%(curry,name))def produce(na_me): c =custumer('A
阅读全文
posted @ 2019-11-15 21:04 ComeIntoBud
阅读(120)
评论(0)
推荐(0)
2019年11月13日
生成式 和生成器
摘要: 生成式 def f(n): return n**3a = [f(x) for x in range(10)] 这就是个简单的生成式print(a) #[0, 1, 8, 27, 64, 125, 216, 343, 512, 729]print(type(a))#<class 'list'>b =
阅读全文
posted @ 2019-11-13 22:02 ComeIntoBud
阅读(161)
评论(0)
推荐(0)
2019年11月11日
装饰器函数初级
摘要: 直接举例子说吧! def test(): print('look look') #这是个普通函数接下来就是个简单的装饰器 (其实装饰器的意义就是:给其它函数增加功能用的) import time #调用时间模块def show_time(): def inner(f): start = time.t
阅读全文
posted @ 2019-11-11 21:48 ComeIntoBud
阅读(128)
评论(0)
推荐(0)
上一页
1
···
3
4
5
6
7
8
下一页
公告