2019年1月23日

sys模块

摘要: """ sys 与解释其相关一些操作 system 代表的不是操作系统而是解释器自己 """ import sys # 获取 / 添加 环境变量 print(sys.path) # 获取调用解释器时传递的参数 第一个永远是执行文件本身 print(sys.argv) # 立即退出解释器 # 状态码可以自定义 执行为0 # sys.exit(-1) # 查看已经加载... 阅读全文

posted @ 2019-01-23 16:50 小胖子方法 阅读(153) 评论(0) 推荐(0)

datetime模块

摘要: import datetime # 获取当前时间 会根据时区自动转换 print(datetime.datetime.now()) # 创建datetime对象 指定时间 print(datetime.datetime(2019,1,23)) # 两个datetime 可以进行减法运算 并且只能减 d1 = datetime.datetime(2019,1,23) d2 = datetime... 阅读全文

posted @ 2019-01-23 16:49 小胖子方法 阅读(106) 评论(0) 推荐(0)

time模块

摘要: """ time 用于处理时间相关 1.获取时间 2.不同格式的时间转换 3.sleep函数 """ import time # 浮点型的时间戳 从unix元年开始到现在的秒数 print(time.time()) #通常用于计算时间差,不会直接给用户看 # 美国的显示格式 print(time.asctime()) #格... 阅读全文

posted @ 2019-01-23 16:48 小胖子方法 阅读(132) 评论(0) 推荐(0)

logging模块

摘要: logging.debug() # 10 logging.info() # 20 logging.warning() # 30 logging.error()# 40 logging.critical() # 50 filename:用指定的文件名创建FiledHandler(后边会具体讲解hand 阅读全文

posted @ 2019-01-23 08:49 小胖子方法 阅读(114) 评论(0) 推荐(0)

导航