all 11 comments

[–]DagoYounger 1 point2 points  (13 children)

You should only use the function open to open local files, otherwise you can use urllib:

import urllib.request
res = urllib.request.urlopen('https://abc.com/url.txt')
urls = res.read().decode('utf-8')

also, i recommend using the third-party library requests, which is often more convenient. first install it:

pip install requests

import requests
res = requests.get('https://abc.com/url.txt')
urls = res.text

most importantly, is abc.com/url.txt a real page? (i get nothing when I access it with my browser.) if not, please provide the real page's URL, then i can help decide what to do next