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

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

 

 

 

 

 

    

相关文章:

  • 2021-08-15
  • 2021-05-30
  • 2021-11-05
  • 2022-03-02
  • 2021-10-29
  • 2021-09-09
  • 2021-07-25
猜你喜欢
  • 2021-08-17
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2021-10-21
  • 2021-08-02
  • 2022-02-28
相关资源
相似解决方案