推荐学习书目
› 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
bestehen
V2EX  ›  Python

Python 中的 pathlib 怎么用

  •  
  •   bestehen · Sep 2, 2018 · 3466 views
    This topic created in 2988 days ago, the information mentioned may be changed or developed.

    Path('/home/stephen/shenjianlin') PosixPath('/home/stephen/shenjianlin') Path('/home/stephen/shenjianlin').parent PosixPath('/home/stephen') 这里我要的是路径 怎么有 PosixPath 这种东西出来?难道要正则处理?

    matrix273
    matrix273
    Sep 2, 2018 via Android
    1
    str(Path())
    Path().stem
    Path().name
    HelloAmadeus
    HelloAmadeus
    Sep 2, 2018
    2
    因为你在 posix 兼容的系统啊, Path 类是一个接口, posixpath 类是具体实现, 你用就行了
    inframe
    inframe
    Sep 2, 2018 via Android
    3
    读一读 官方的帮助文档
    写得很清楚的
    bestehen
    bestehen
    OP
    Sep 2, 2018
    4
    @matrix273 解决了谢谢
    bestehen
    bestehen
    OP
    Sep 2, 2018
    5
    @inframe 你说的官方文档是那个 piyi 的 homepage 吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   751 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 23:18 · PVG 07:18 · LAX 15:18 · JFK 18:18
    ♥ Do have faith in what you're doing.