import os, re """ 查看文件夹下的所有文件及文件夹 join为拼接函数 """ def Look_File(path): for root , dirs, files in os.walk(path): print(root) #主目录 for item in files: #主目录... ...
分类:
其他好文 时间:
2018-01-31 01:10:12
阅读次数:
175
os.walk()遍历所有的文件并列出各级,os.listdir()只列出当前文件下的条目,一个列表 1.os.walk() 大材小用。 2,listdir() ...
分类:
其他好文 时间:
2018-01-31 00:53:12
阅读次数:
524
对文件进行打包操作 import osimport tarfile#压缩,创建.gz#创建压缩包名tar = tarfile.open('/tmp/tartest.tar.gz','w:gz')# 创建压缩包for root,dir,files in os.walk("/tmp/tartest"):... ...
分类:
编程语言 时间:
2018-01-27 15:31:43
阅读次数:
203
People always want to lead an active life, and is not it? 人们总要乐观生活,不是吗? Be active, and walk towards things you want to touch. Even if it is far away f ...
分类:
其他好文 时间:
2018-01-21 12:32:32
阅读次数:
148
1.count() 2.array_count_values()和array_unique() 3.array_filter() 4.array_walk() 5.sort()和asort() 6.ksort() 7.自定义排序 ...
分类:
编程语言 时间:
2018-01-20 20:29:54
阅读次数:
172
P1821 [USACO07FEB]银牛派对Silver Cow Party 题目描述 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow part ...
分类:
其他好文 时间:
2018-01-06 16:01:03
阅读次数:
166
import os import docx def scanfile(rootdir): result = [] for f in os.walk(rootdir): for files in f[2]: if files.endswith('.py'): result.append(os.path... ...
分类:
编程语言 时间:
2018-01-03 11:38:54
阅读次数:
157
POJ - 2230 Watchcow Watchcow Bessie's been appointed the new watch-cow for the farm. Every night, it's her job to walk across the farm and make sure t ...
分类:
其他好文 时间:
2018-01-01 16:54:16
阅读次数:
192