abbarnes

Read URL File

Mar 20th, 2018
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import urllib.request as url
  2.  
  3. URL_LINK = ''
  4.  
  5. data = url.urlopen(URL_LINK)
  6. data_bytes = data.read()
  7. data_string = data_bytes.decode('utf8')
  8. data.close()
  9.  
  10. def generate_line_list(multi_line_string):
  11.     '''Input: multi-line string.  Output: a list of each line in the string.'''
  12.     return data_string.split('\n')
Advertisement
Add Comment
Please, Sign In to add comment