V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
diver02
V2EX  ›  Python

Python _file_ 参数飘红,无解

  •  
  •   diver02 · 2019-09-14 18:04:00 +08:00 · 3109 次点击
    这是一个创建于 1677 天前的主题,其中的信息可能已经有所发展或是发生改变。

    8 条回复    2019-09-15 16:17:55 +08:00
    BingoXuan
        1
    BingoXuan  
       2019-09-14 18:09:23 +08:00   ❤️ 3
    你应该是想用__file__吧,而不是_file_

    吟唱 python 魔法都要用双下划线开头双下划线结束的,不然施法失败炸了自己
    unixeno
        2
    unixeno  
       2019-09-14 18:10:36 +08:00 via Android
    所以_file_是啥
    diver02
        3
    diver02  
    OP
       2019-09-14 19:08:04 +08:00
    @unixeno 才入门,我太蔡了
    fakepoet
        4
    fakepoet  
       2019-09-14 19:08:25 +08:00
    看得脑袋疼,尽量 PEP8 一点吧
    diver02
        5
    diver02  
    OP
       2019-09-14 20:32:55 +08:00
    GTX765
        6
    GTX765  
       2019-09-15 10:19:56 +08:00 via iPhone
    个人建议 os 和 os.path 熟悉了之后就不要用了 是不是 pathlib
    GTX765
        7
    GTX765  
       2019-09-15 10:20:49 +08:00 via iPhone
    @GTX765 试一试*
    diver02
        8
    diver02  
    OP
       2019-09-15 16:17:55 +08:00
    @GTX765 我了解下
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3732 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 04:35 · PVG 12:35 · LAX 21:35 · JFK 00:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.