会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
fly_bk
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
···
43
下一页
2022年2月24日
python实现装饰器模式
摘要: """ 修饰器模式 """ import functools def memoize(fn): known = dict() @functools.wraps(fn) def memoizer(*args): if args not in known: known[args] = fn(*args)
阅读全文
posted @ 2022-02-24 14:01 fly_bk
阅读(48)
评论(0)
推荐(0)
2022年2月23日
网友大实话系列
摘要: 我觉得有些群员心态还是没有放稳,现在这么好的带薪聊天机会,不珍惜,你给老板打工搬砖,你能学到东西吗?你在群里聊天,你培养的交际能力,是实打实的呀,是跟着你一辈子的呀,不要把眼光老是放在工资工资上面,你将来能力有了,你去哪儿不能高就?说了这么多,一起摸鱼吧。怎么回事,好久没人讲话了,今天是工作日啊,工
阅读全文
posted @ 2022-02-23 13:29 fly_bk
阅读(73)
评论(0)
推荐(0)
2022年2月19日
python日志模块使用
摘要: """ 日志模块的使用 """ import logging # 加上filename,日志会输出到文件里 logging.basicConfig(filename='myProgramLog.txt', level=logging.DEBUG, format=' %(asctime)s - %(l
阅读全文
posted @ 2022-02-19 10:53 fly_bk
阅读(172)
评论(0)
推荐(0)
python中异常的保存及断言(用到traceback,assert)
摘要: """ 异常信息保存到文件中 """ import traceback try: raise Exception('This is the error message.') except: errorFile = open('errorInfo.txt', 'w') errorFile.write(
阅读全文
posted @ 2022-02-19 10:06 fly_bk
阅读(134)
评论(0)
推荐(0)
2022年2月14日
zipfile模块操作zip压缩文件
摘要: import zipfile def write(): """创建和添加到zip文件""" # 创建压缩文件 new_zip = zipfile.ZipFile('new.zip', 'w') # 和添加到ZIP的文件 new_zip.write('a.txt', compress_type=zip
阅读全文
posted @ 2022-02-14 09:54 fly_bk
阅读(276)
评论(0)
推荐(0)
shutil模块操作文件
摘要: """ shutil(或称为 shell 工具)模块中包含一些函数, 让你在 Python 程序中复制、移动、改名和删除文件 """ import os import shutil cwd = os.getcwd() def copy(): """复制一个文件,返回被复制文件的新名字""" os.m
阅读全文
posted @ 2022-02-14 09:19 fly_bk
阅读(80)
评论(0)
推荐(0)
2022年2月10日
shelve与pprint
摘要: """ 利用 shelve 模块,你可以将 Python 程序中的变量保存到二进制的 shelf 文件中。 这样,程序就可以从硬盘中恢复变量的数据 """ import shelve def save(): # 在 OS X 上,只会创建一个 mydata.db 文件 # 调用函数shelve.op
阅读全文
posted @ 2022-02-10 09:00 fly_bk
阅读(52)
评论(0)
推荐(0)
2022年2月9日
File模块操作文件
摘要: helloFile = open('./hello.txt') # 默认是读模式 helloContent = helloFile.read() helloFile.close() print(helloContent) # 以使用 readlines()方法,从该文件取得一个字符串的列表。 # 列
阅读全文
posted @ 2022-02-09 09:39 fly_bk
阅读(59)
评论(0)
推荐(0)
OS模块基本使用
摘要: import os print(os.path.join('usr', 'local', 'bin')) print(os.getcwd()) print(os.path.abspath('.')) print(os.path.abspath('./Os.py')) print(os.path.is
阅读全文
posted @ 2022-02-09 09:22 fly_bk
阅读(44)
评论(0)
推荐(0)
2022年2月8日
python剪切板操作使用第三方库pyperclip
摘要: import pyperclip # 向剪切板写内容 pyperclip.copy('hello world') # 获取剪切板的内容 print(pyperclip.paste())
阅读全文
posted @ 2022-02-08 12:41 fly_bk
阅读(225)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
···
43
下一页
公告