__file__

__file__ 是 python 的内置变量它的值等于文件名本身

[root@localhost ~]$ cat test.py 
#!/usr/bin/env python
print(__file__)
[root@localhost ~]$ python test.py 
test.py

 

 

 

 

 

    

posted @ 2019-01-17 09:46  孔雀东南飞  阅读(259)  评论(0编辑  收藏  举报