python判断是否是中文路径

import os
mypath = raw_input("Please inmput directory to create:");
if not len(mypath):
    print 'Error: no path specified => exit!'
    quit();
for c in mypath:
    if ord(c) > 127:
        print 'Can not create dir with Chinese';
        quit();
try:
    os.mkdir(mypath)
except:
    print 'Directory creation failure! => exit!'
    quit();
print 'Create dir %s successfully!' %(mypath);

你可能感兴趣的:(python判断是否是中文路径)