How to read a TXT file from the Internet?

Hello, how can I read a TXT file from the Internet and print its contents to print?
June 3rd 19 at 19:12
1 answer
June 3rd 19 at 19:14
pip3 install requests

import requests

url = 'http://somewhere.com/file.txt'
string = requests.get(url).text

Find more questions by tags Python