从今年元旦开始学C++,3月中旬开始移师Python,已创建了近百篇博客,有必要编个目录总结一下学习成果了 :)
import urllib.request lsturl=['https://blog.csdn.net/boysoft2002/article/details/', '112895584', '113916668', '115311607', '111057600', '112058765', '112649841', '112692650', '112758172', '112779716', '112852909', '112856888', '112983320', '112988386', '113037891', '113097166', '113145924', '113358043', '113446108', '113457253', '113529687', '113575820', '113622310', '113667015', '113697110', '113730868', '113772948', '113777228', '113787352', '113839813', '113858220', '113866928', '113872254', '113900792', '113926135', '114001024', '114047975', '114110148', '114154178', '114155994', '114163091', '114218122', '114175726', '114263346', '114222330', '114278061', '114300111', '114379446', '114383181', '114392833', '114416302', '114420231', '114441632', '114493856', '114557442', '114661201', '114702681', '114727175', '114801480', '114854993', '114896783', '114921167', '114927920', '115016170', '115044792', '115141151', '115190848', '115221872', '115260859', '115263165', '115289048', '115335269', '115359958', '115386613', '115407588', '115419833', '115425651', '115427777', '115438094', '115495837', '115563015', '115609329', '115641162', '115680965', '115796371', '115711808', '115917064', '115985659', '116240602', '116358084', '116376069', '116400341'] lsturl=[lsturl[0]]+sorted(lsturl[1:]) for i in range(1,len(lsturl)): url=lsturl[0]+lsturl[i] req=urllib.request.Request(url) try: resp=urllib.request.urlopen(req) data=resp.read().decode('utf-8') start=data.find('<title>') end=data.find('</title>') t=data[start+7:end] t=t.replace('_boysoft2002的专栏-CSDN博客','') d=data.split('<span class=\"time\">')[1] d=d.split('</span>')[0][:10] print(i,d,'《'+t+'》') print('<br><a href=\"'+url+'\">',url,'</a><br>') except: print('Error')