In Python, calling
temp = open(filename,\'r\').readlines()
results in a list in which each element is a line in the file. It\'s a little st
my_file = open("first_file.txt", "r") for line in my_file.readlines(): if line[-1:] == "\n": print(line[:-1]) else: print(line) my_file.close()
temp = open(filename,'r').read().split('\n')
Try this:
u=open("url.txt","r") url=u.read().replace('\n','') print(url)