摘要:
import osprint(os.path.join('F:\\万金鑫\Python\工程文件','2')) #告诉他路径 import osprint(os.getcwd()) #获得文件路径 阅读全文
posted @ 2021-08-25 22:12
金涛拍岸
阅读(41)
评论(0)
推荐(0)
摘要:
import osfor file in os.scandir(): print(file.stat())#sizi=字节(大小),ctime=创建时间,mtime=修改时间,atime=最近访问时间 #时间戳转换 import time import datetimeprint(time.ctim 阅读全文
posted @ 2021-08-25 22:11
金涛拍岸
阅读(108)
评论(0)
推荐(0)
摘要:
with open('note.txt','r',encoding='utf-8')as f: print(f.readlines()) #读取! #写入with open('a.txt','w',encoding='utf-8') as a: #“w” a.write('你好?') a.write 阅读全文
posted @ 2021-08-25 22:11
金涛拍岸
阅读(60)
评论(0)
推荐(0)
摘要:
#内置import oslst = os.listdir()print(lst)for I in lst: if I.endswith('.py'): # 在当前文件夹里寻找以”.py“结尾的文件 print(I)print('____________________________________ 阅读全文
posted @ 2021-08-25 22:10
金涛拍岸
阅读(174)
评论(0)
推荐(0)
摘要:
#临时文件from tempfile import TemporaryFilefile=TemporaryFile('w+')file.write('杨老师好')file.seek(0)print(file.readlines())print(file.name)#查路径input('1234567 阅读全文
posted @ 2021-08-25 22:09
金涛拍岸
阅读(235)
评论(0)
推荐(0)

浙公网安备 33010602011771号