python中__file__属性的使用

Python (100) 2023-08-01 03:06:05

说明

1、这个__file__属性是模块的特殊属性,类似于__name__。

2、每个测试都是用Python脚本编写的,测试脚本文件名称作为标题。然后执行这些脚本,使用_file__特殊属性印刷状态。

实例

project/
|
├──tests/
|├──test_commanding.py
|├──test_power.py
|├──test_wireHousing.py
|└──test_leds.py
|
└──main.py

以上就是python中__file__属性的使用,希望对大家有所帮助。

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。

THE END

发表回复