import os
import shutil
def is_Chinese(ch):
return '\u4e00' <= ch <= '\u9fff'
def get_name(f):
for index in range(len(f)):
if not is_Chinese(f[index]):
return f[0:index]
path = os.listdir(os.getcwd())
for p in path:
name = get_name(p)
if name is not '':
if not os.path.exists(name):
os.mkdir(name)
shutil.move(p, name)
网友评论