import os
path=r"C:\Users\bxzyz\Desktop\doc\ocr\data\orc-data\annotations"
创建字符对应文件夹
for i in range(1,63):
name="charactor-"+str(i).zfill(3)
chpath=os.path.join(path,name)
os.makedirs(chpath)
#print(chpath)
图1.PNG
dict={}
创建字符与文件夹的对应字典
num=[ x for x in range(48,58)]
Chara=[x for x in range(65,91)]
chara=[x for x in range(97,123)]
num.extend(Chara)
num.extend(chara)
dic=[]
for i in range(62):
#dic.append(chr(num[i]))
dict[chr(num[i])]=str(i).zfill(3)
dict
{'0': 'charactor-001',
'1': 'charactor-002',
'2': 'charactor-003',
'3': 'charactor-004',
'4': 'charactor-005',
'5': 'charactor-006',
'6': 'charactor-007',
'7': 'charactor-008',
'8': 'charactor-009',
'9': 'charactor-010',
'A': 'charactor-011',
'B': 'charactor-012',
'C': 'charactor-013',
'D': 'charactor-014',
'E': 'charactor-015',
'F': 'charactor-016',
'G': 'charactor-017',
'H': 'charactor-018',
'I': 'charactor-019',
'J': 'charactor-020',
'K': 'charactor-021',
'L': 'charactor-022',
'M': 'charactor-023',
'N': 'charactor-024',
'O': 'charactor-025',
'P': 'charactor-026',
'Q': 'charactor-027',
'R': 'charactor-028',
'S': 'charactor-029',
'T': 'charactor-030',
'U': 'charactor-031',
'V': 'charactor-032',
'W': 'charactor-033',
'X': 'charactor-034',
'Y': 'charactor-035',
'Z': 'charactor-036',
'a': 'charactor-037',
'b': 'charactor-038',
'c': 'charactor-039',
'd': 'charactor-040',
'e': 'charactor-041',
'f': 'charactor-042',
'g': 'charactor-043',
'h': 'charactor-044',
'i': 'charactor-045',
'j': 'charactor-046',
'k': 'charactor-047',
'l': 'charactor-048',
'm': 'charactor-049',
'n': 'charactor-050',
'o': 'charactor-051',
'p': 'charactor-052',
'q': 'charactor-053',
'r': 'charactor-054',
's': 'charactor-055',
't': 'charactor-056',
'u': 'charactor-057',
'v': 'charactor-058',
'w': 'charactor-059',
'x': 'charactor-060',
'y': 'charactor-061',
'z': 'charactor-062'}
网友评论