赞
踩
- #设置存储文件夹
- FName = text1.findAll('h1')[1].text
- if not os.path.exists(FName):
- os.mkdir(FName)
- #目录下各章节链接获取
- t = '<a style="" href="(.*?)">'
- AllUrl= re.findall(t, response.text)
注意:txt存储存在文件名存在格式问题。故:
- #判断存储文件名类型,去除不符合条件文件名
- for NoName in ["?","/","~","*","<",">",":","|"]:
- if(fileName[-1]==NoName):
- fileName=fileName[0:len(fileName)-1]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。