摘要: Python文本读取 按关键字查找文件内容,并保存为文件 from os import replace import re file = "d:/gdshnd_scm_0.txt" with open(file) as f: content = f.readlines() if content: f 阅读全文
posted @ 2021-09-28 14:48 茶叶蛋蛋 阅读(1194) 评论(0) 推荐(0)
摘要: 函数isinstance()可以判断一个变量的类型,既可以用在Python内置的数据类型如str、list、dict,也可以用在我们自定义的类,它们本质上都是数据类型。 假设有如下的 Person、Student 和 Teacher 的定义及继承关系如下: class Person(object): 阅读全文
posted @ 2021-09-28 08:57 茶叶蛋蛋 阅读(448) 评论(0) 推荐(0)