I can't figure out how to remove the carriage return (\ n) from the file name. I create the file as follows:
# -*-coding: utf-8 -*- input_file = open("test", 'r') for line in input_file: NAMEFILE = line+".txt" print (NAMEFILE) output_file = open("./testfolder/"+NAMEFILE, 'w') output_file.write("String:"+line) output_file.close() input_file.close() The content of the source file is simple:
123234 123456 .... Files with string names are created, that is 123234.txt 123456.txt, etc. but between the name and the extension there is a newline character, how to remove it?