tuoheng_algN/vodsdk/test/语法/全局变量.py

27 lines
450 B
Python

def get_mathematical_score():
return 90
def get_english_score():
return 95
def get_history_score():
return 98
def get_score_by_course(course):
"""
根据课程获取考试分数
:param course:
:return:
"""
global_dict = globals()
print(global_dict)
func_name = 'get_{course}_score'.format(course=course)
func = global_dict.get(func_name)
return func()
print(get_score_by_course('history'))