摘要: """ file path """ __author__on__ = 'shaozhiqi 2019/9/23' # !/usr/bin/env python3 # -*- coding: utf-8 -*- # os模块的基本功能 import os print(os.name) # nt # 如果是posix,说明系统是Linux、Unix或Mac OS X,如果是nt,就是Windows系统 阅读全文
posted @ 2019-09-23 18:56 ~清风煮酒~ 阅读(2404) 评论(0) 推荐(0) 编辑
摘要: """ StringIO和BytesIO """ __author__on__ = 'shaozhiqi 2019/9/23' # !/usr/bin/env python3 # -*- coding: utf-8 -*- # 很多时候,数据读写不一定是文件,也可以在内存中读写。 # StringIO顾名思义就是在内存中读写str。 # 要把str写入StringIO,我们需要先创建一个Strin 阅读全文
posted @ 2019-09-23 18:55 ~清风煮酒~ 阅读(361) 评论(0) 推荐(0) 编辑
摘要: """ 文件读写 """ __author__on__ = 'shaozhiqi 2019/9/23' # !/usr/bin/env python3 # -*- coding: utf-8 -*- # 读文件的模式打开一个文件对象,使用Python内置的open()函数,传入文件名和标示符 f = open('D:/temp/shao.txt', 'r', encoding='UTF-8') p 阅读全文
posted @ 2019-09-23 18:54 ~清风煮酒~ 阅读(686) 评论(0) 推荐(0) 编辑
摘要: """ 单元测试 """ __author__on__ = 'shaozhiqi 2019/9/23' class Dict(dict): def __init__(self, **kw): super().__init__(**kw) def __getattr__(self, key): try: return... 阅读全文
posted @ 2019-09-23 18:53 ~清风煮酒~ 阅读(186) 评论(0) 推荐(0) 编辑
摘要: """ 调试 """ __author__on__ = 'shaozhiqi 2019/9/23' # 调试程序 # 1. print打印,没问题了上线还得删掉 # 2. 断言、assert # n不等于0则继续执行,否则走断言的处理,Python解释器时可以用-O参数来关闭assert # def foo(s): # n = int(s) # assert n != 0, ... 阅读全文
posted @ 2019-09-23 18:51 ~清风煮酒~ 阅读(399) 评论(0) 推荐(0) 编辑