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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -