When I insert, I get weird output
But when I do this: get: getReference = open ('test.txt', 'r') for the line in getReference: # os.path Try .exists ('+ + +'. Txt '): Except IOError as E with (' + + ''. Txt ') Open: newURL =' http: //www.intrat.th/ '+' '.' Join (line) + ' Fsta 'print newURL
When I print a new URL it does not give me a line text, but instead it has it. Why does fsta on the second line happen?
your line:
for the line in the getReference: will repeat the lines in the file, which will contain new line characters (and \ r). Therefore, you are probably trying to open a file 'filename \ n.txt', which is not what you mean to do.
As a solution, use the bar:
with open ('' + line.strip () + '. Txt') F: Pass
Comments
Post a Comment