📜  pathlib 路径正向或反向斜杠 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:15.396000             🧑  作者: Mango

代码示例1
>>> import pathlib
>>> p = pathlib.PureWindowsPath(r'\dir\anotherdir\foodir\more')
>>> print(p)    
\dir\anotherdir\foodir\more
>>> print(p.as_posix())
/dir/anotherdir/foodir/more
>>> str(p)
'\\dir\\anotherdir\\foodir\\more'
>>> str(p.as_posix())
'/dir/anotherdir/foodir/more'