TypeError:传递给列表的格式字符串不受支持。__format__无法正确获取此格式

时间:2019-03-19 09:29:20

标签: python-3.x typeerror

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)

0 个答案:

没有答案