Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to create a method in Python that reads from this online custom Lou’

ID: 3682801 • Letter: I

Question

I'm trying to create a method in Python that reads from this online custom Lou’s List interface:http://stardock.cs.virginia.edu/louslist/Courses/view/

The method should returns a list containing each instructor listed in Lou’s List for the given department. So if I call the method: instructors("EAST") it should print a list with only the instructors names. By replacing the text after the last / in the website with any department at the university you should obtain the classes of that department. This is my code, but I'm getting a error. Can someone show me how to create this method?

01 import urllib.request

Explanation / Answer

import requests

intructer_list = []
def instructors(department):
   link="http://stardock.cs.virginia.edu/louslist/Courses/view/"+department
   stream=requests.get(link,headers={"content-type":"text"}).text
   entry = []
   print stream
   for line in stream.split(' '):
       decoded = line.strip().decode("UTF-8")     
       entry.append(decoded.split(";"))
   for line in entry:
       if len(line)> 4:
           intructer_list.append(line[4])
   return intructer_list
print(instructors("CS"))
print intructer_list