''' Purpose: determine the hidden super power of a CS 1112 person ''' # need help to get web data - so import the capability from urllib.request import urlopen # define the base folder for course participants BASE_CS1112_PEOPLE_URL = 'http://www.cs.virginia.edu/~cs1112/people/' FILE_NAME = 'my-power.txt' # get computing id of interest reply = input( 'Enter computing id: ' ) # clean up the reply to get the user id user_id = reply.strip() user_id = user_id.lower() # specify web folder of indicated person web_folder = BASE_CS1112_PEOPLE_URL + user_id + '/' # specify link for super power web file of indicated person link = web_folder + FILE_NAME # get a connection to stream the web resource of interest stream = urlopen( link ) # read stream to get the contents of the page content = stream.read() # decode contents into plain text form text = content.decode( 'UTF-8' ) # cleaned-up text is the superpower of interest power = text.strip() # print power print( power )