求教Unicode编码问题啊
解决不了
求教大神。。。。
先放一边了
# -*- coding: utf-8 -*-
import os
import re
path1 = []
class clear(object):
def __init__(self, filepath, num = 0):
self.filepath=unicode(filepath,'utf8')
self.num = num
self.dr()
def path(self ,a , b):
return os.path.join(a, b)
def re_ser(self, a):
h = '\([123456789]\)'
m = re.search(h, a)
print m
c = True if m else False
return c
def dr(self):
os.chdir(self.filepath)
cwd1 = os.getcwd()
fn1 = os.listdir(cwd1)
for i in fn1:
fname1 = self.path(cwd1, i)
fname1 = unicode(fname1, 'utf-8')
if self.re_ser(i):
path1.append(fname1)
else:
os.chdir(fname1)
cwd2 = os.getcwd()
fn2 = os.listdir(cwd2)
for k in fn2:
fname2 = self.path(cwd2, k)
if self.re_ser(k):
path1.append(fname2)
print path1
for i in path1:
os.remove(i)
if __name__ == '__main__':
clear('D:\\BaiduYunDownload\\13年基础班(基础班推荐学此套)\\0805\\代码')