I am trying to make a program which opens an URL written in a text file. My program reads from the file and tries to open the url but gets the error
TypeError: startfile: filepath should be string, bytes or os.PathLike, not list
I have tried readlines()
, readline()
as i wish to open the second url in the file.
Here is the code
import webbrowser as wb
r_file = open("Websites.txt","r")
url = r_file.readlines()
print(url)
wb.open(url, new=0)
r_file.close()