import urllib.request BASE_URL = 'http://www.cs.virginia.edu/~cs1112/people/' reply = input( 'Enter computing id: ' ) id = reply.strip() id = id.lower() person_url = BASE_URL + id + '/' link = person_url + 'poem.txt' #recognise and rememmber this pattern stream = urllib.request.urlopen( link ) contents = stream.read() print( contents) text = contents.decode( 'UTF-8' ) print( text ) text = text.strip() lines = text.split('\n') print ( lines ) cleaned_lines = [] for line in lines: clean = line.strip() cleaned_lines.append(clean) print( cleaned_lines ) # backslash is in front of an escape character forward is division