d={'0447': ('BALU', ['OOPS', 'D.NET', 'ADVANCE DBMS']), '0954': ('SONIKA', ['DSD', 'DAA']), '1337': ('VAISHU', ['SE', 'EE'])}
得到类型错误:
def neat_printer(dictionary,titles,width):
formatting = ""
for i in range(0,len(titles)):
formatting += "{:<"+str(width)+"}"
print(formatting.format(*titles))
for key,value in dictionary.items():
sv = []
for subvalue in value:
sv.append(subvalue)
print(formatting.format(key,*sv))
neat_printer(d,["Facultyid","Name","Subjects Allocated"],20)