1.递归创建多级文件夹
os.makedirs(my_dir)
2.一个很好字符串判断方法:
if not img_list[i].endswith('.png'):
endswith('')判断结尾字符串。
3.一个列表元素添加的新方法:
imgs.append((word[0],int(word[1])))
[('aaa', 1), ('aaa', 1)]
里面元素不是列表类型,不过最好选择列表,这样方便转换。
os.makedirs(my_dir)
if not img_list[i].endswith('.png'):
endswith('')判断结尾字符串。
imgs.append((word[0],int(word[1])))
[('aaa', 1), ('aaa', 1)]
里面元素不是列表类型,不过最好选择列表,这样方便转换。
本文标题:python 多级文件夹创建目录
本文链接:https://www.haomeiwen.com/subject/aosfdqtx.html
网友评论