import os
print(os.listdir()) #列出当前目录下的文件
print(os.getcwd()) #获取绝对路径
if not os.path.exists("b"):
os.mkdir("b")
if not os.path.exists("b/test.ext"):
f = open("b/text.txt","w")
f.write("hello,feifei") #写入
f.close()
time
import time
#打印当前时间
print(time.time())
print(time.localtime())
print(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())) #格式化
#打印两天前的时间
now_timestamp = time.time()
two_days_ago = now_timestamp - 2*24*60*60
time_tuple = time.localtime(two_days_ago)
print(time.strftime("%Y-%m-%d %H:%M:%S",time_tuple))
import math
print(math.ceil(5.4)) #大于等于的整数
print(math.floor(5.5)) #小于等于的整数
资料获取方法
【留言777】
各位想获取源码等教程资料的朋友请点赞 + 评论 + 收藏,三连!
三连之后我会在评论区挨个私信发给你们~