写爬虫时有的图片类别的名字不能直接做目录名,可以做以下转换
def rUnsupportChar(s): # 替换不能作为目录名的字符 <> : * " ? |
unSupChar = r'''
<>:*"?\
'''
supChar=r'''
()-^~$-
'''
trans=string.maketrans(unSupChar,supChar)
s = s.translate(trans, "")
return s