python - Cant use a string because of \n? -
when running code error because of \n @ end of string. how can fix this?
import urllib prefix = 'http://archive.outernet.is/' open(!file_list.txt, 'r') f: stock = f.read().splitlines() l in stock: l = l.strip() content = ("%s%s") % (prefix, l) print(content) urllib.request.urlretrieve(content, l)
file list contains
1.zip 2.zip 3.zip
and error code goes like
errno 2, no such file or directory 'website.ca/1.zip\n'
strip whitespace each line:
for l in stock: l = l.strip() content = ("%s%s") % (prefix, l) # etc. ...
Comments
Post a Comment