摘要: ps man 1 ps 支持的命令格式 unix格式:-h -e,短格式 bsd格式: a,x,u格式 ,不加-的格式 gnu长格式:--help,长格式 [root@iZ2~]# ps PID TTY TIME CMD 4234 pts/0 00:00:00 bash 4455 pts/0 00: 阅读全文
posted @ 2022-09-19 18:03 红丿领巾 阅读(109) 评论(0) 推荐(0)
摘要: os模块:#删除重命名os.remove(r'a.txt'),r表示里面的字符不转义os.rename('a.txt','b.txt')#删除目录,必须是空目录os.removedirs('aa'),不为空删不了#使用shutil模块可以删除带内容的目录shutil.rmtree('aa')#和路径 阅读全文
posted @ 2022-09-19 15:27 红丿领巾 阅读(38) 评论(0) 推荐(0)
摘要: 1.datetime模块封装了一些时间,日期datetimetimedeltaimport datetime#date类 :年月日d=datetime.date(2022,10,10)print(d.year)print(d.month)print(d.day) #time类:时分秒t=dateti 阅读全文
posted @ 2022-09-19 14:57 红丿领巾 阅读(29) 评论(0) 推荐(0)
摘要: 1.今日模块的介绍time datatimeos syshashlib(加密) json(序列化) pickle(反序列化) cellections集合 import time获取时间戳:从时间元年1970 1.1 00:00:00 到现在经过的秒数time.time 获取格式化时间对象,是9个自动 阅读全文
posted @ 2022-09-19 12:08 红丿领巾 阅读(30) 评论(0) 推荐(0)
摘要: ###Python核心编程\基础教程\流畅的python\数据结构与算法(机械工业出版)\cook book# import time# class Time:# def __init__(self,year,month,day):# self.year=year# self.month=month 阅读全文
posted @ 2022-09-19 11:33 红丿领巾 阅读(23) 评论(0) 推荐(0)
摘要: #bytes#bytearray#以学过的线性结构:List tuple str bytes bytearray#q切片sequence(start:stop)#sequence(start:stop:step)x=tuple(range(10))x=(0, 1, 2, 3, 4, 5, 6, 7, 阅读全文
posted @ 2022-09-19 11:27 红丿领巾 阅读(144) 评论(0) 推荐(0)
摘要: #装饰器:在不改变原函数的代码以及调用方式的前提下,为其增加新的功能#开放:对代码的扩展开放的#封闭:对源码的修改是封闭的#装饰器:完全遵守开放封闭原则# 练习记得测一下#@语法糖def wrapper(f): def inner(*args,**kwargs): ret=f(*args,**kwa 阅读全文
posted @ 2022-09-19 11:26 红丿领巾 阅读(47) 评论(0) 推荐(0)
摘要: #匿名函数:一句话函数,比较简单的函数 # def func(a,b):# return a+b #构建匿名函数,lambda相当于def,关键字# #,a,b相当于形参:,a+b 返回值func1=lambda a,b: a+bprint(func1(4,4)) 阅读全文
posted @ 2022-09-19 11:25 红丿领巾 阅读(23) 评论(0) 推荐(0)
摘要: #python 提供了68个内置函数 #callable 判断一个对象是否可被调用#bin:将十进制转换成二进制并返回#oct:将十进制转化成八进制字符串并返回#hex:将十进制转化成十六进制字符串并返回 #divmod(10,3) 返回商3余1(3,1)#bytes ***s1='太白'# b=s 阅读全文
posted @ 2022-09-19 11:25 红丿领巾 阅读(21) 评论(0) 推荐(0)
摘要: apple 10 3tesla 100000 1mac 3000 31evon 3000 3chicken 10 3 #a.txt。作业要求,将里面内容,构建成[{'name':'apple','price':'10','amount':3},{'name':'tesla','price':'300 阅读全文
posted @ 2022-09-19 11:23 红丿领巾 阅读(26) 评论(0) 推荐(0)