class Stu_A(object):
name='student{}'
other_name=name.format('A') def __init__(self):
passa=Stu_A()
print(a.other_name)class Stu_B(object):
name='student{}'
other_name=name.format('A')
name_list = [name.format(i) for i in 'BCDE'] def __init__(self):
pass
b=Stu_B()
print(b.name_list)Stu_B 这个类无法被创建
提示的错误信息: NameError: name 'name' is not defined
RISEBY
皈依舞
随时随地看视频慕课网APP