#!/usr/bin/python #coding=utf-8 #@rename file #@2019/11/27 import os ls = os.rename('/root/tigergao.py','/root/test.py') print("重命名成功") files = os.listdir('/root') for file in files: if '.py' in file: print file # else: # print("文件不存在")
#!/usr/bin/python #@listdir #@2019/11/27 #coding = utf-8 import os files = os.listdir('/root') for file in files: print file