获取当前的python块名称(即.py文件名) import os module_name = str(os.path.basename(__file__)).split('.')[0] print(module_name) 相关文章: