整体步骤:
- 首先在网页端打开需要下载的网页。
- 然后右键选择“查看源文件”。
- 将里面的内容复制保存到txt文件中。
- 对txt文件进行处理。
- 打开迅雷下载即可。
对txt文件进行处理
运行完毕后,将生成的txt的最前面删除[]
,最后面处理一下。即可。
import os
# 1为train sat 的网页“查看源文件”的内容复制。
# 2为train map
# 3为valid sat
# 4为valid map
# 5为test sat
# 6为test map
with open('1.txt', 'r') as file1:
lines1 = file1.readlines()
file1.close()
out1 = []
for line1 in lines1:
temp1 = line1[9:84]
print(temp1, end='\n')
temp1= temp1+'\n'
out1 = str(out1) + str(temp1)
os.system('clear')
file11 = open('11.txt', 'w')
file11.write(out1)
file11.close()
with open('2.txt', 'r') as file2:
lines2 = file2.readlines()
file2.close()
out2 = []
for line2 in lines2:
temp2 = line2[9:83]
print(temp2, end='\n')
temp2 = temp2 + '\n'
out2 = str(out2) + str(temp2)
os.system('clear')
file22 = open('22.txt', 'w')
file22.write(out2)
file22.close()
with open('3.txt', 'r') as file3:
lines3 = file3.readlines()
file3.close()
out3 = []
for line3 in lines3:
temp3 = line3[9:84]
print(temp3, end='\n')
temp3 = temp3 + '\n'
out3 = str(out3) + str(temp3)
os.system('clear')
file33 = open('33.txt', 'w')
file33.write(out3)
file33.close()
with open('4.txt', 'r') as file4:
lines4 = file4.readlines()
file4.close()
out4 = []
for line4 in lines4:
temp4 = line4[9:83]
print(temp4, end='\n')
temp4 = temp4 + '\n'
out4 = str(out4) + str(temp4)
os.system('clear')
file44 = open('44.txt', 'w')
file44.write(out4)
file44.close()
with open('5.txt', 'r') as file5:
lines5 = file5.readlines()
file5.close()
out5 = []
for line5 in lines5:
temp5 = line5[9:83]
print(temp5, end='\n')
temp5 = temp5 + '\n'
out5 = str(out5) + str(temp5)
os.system('clear')
file55 = open('55.txt', 'w')
file55.write(out5)
file55.close()
with open('6.txt', 'r') as file6:
lines6 = file6.readlines()
file6.close()
out6 = []
for line6 in lines6:
temp6 = line6[9:82]
print(temp6, end='\n')
temp6 = temp6 + '\n'
out6 = str(out6) + str(temp6)
file66 = open('66.txt', 'w')
file66.write(out6)
file66.close()