Generating urls very quicky
I recently needed to download a range of files from the web but i didnt want to start every single downlaod there were over 300 files lots of click and lots of time. Luckily for me the file were generic in name so all I had to do was write a script that wrote the files to a txt files, here the first part of the code I'll leave it to some else else to provide the download part.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Arr=[] string1 = 'http://www.mysite.com/?fileid=' for i in range(1, 400): Arr.append(string1 + str(i)) else: print 'The for loop is over' f = file('c:\\foo.txt', 'w') # you can use f.write(str(Arr) + '\n') # but this write the entire list with single quotes for j in Arr: f.write(j + '\n') f.close() [code] |
