Browse Source

Pathlib

pull/22/head
Jure Šorn 6 years ago
parent
commit
2d18c617d7
1 changed files with 12 additions and 12 deletions
  1. 24
      README.md

24
README.md

@ -970,21 +970,21 @@ pwd = Path()
``` ```
```python ```python
<iter> = <Path>.iterdir() # Returns all files in a dir. <iter> = <Path>.iterdir() # Returns all files in a dir.
<iter> = <Path>.glob('<pattern>') # Returns all matches. <iter> = <Path>.glob('<pattern>') # Returns all matches.
<Path> = <Path>.resolve() # Makes path absolute. <Path> = <Path>.resolve() # Makes path absolute.
<bool> = <Path>.exists() <bool> = <Path>.exists()
<bool> = <Path>.is_dir() <bool> = <Path>.is_dir()
<file> = <Path>.open() <file> = <Path>.open()
``` ```
```python ```python
<str> = str(<Path>) # Returns path as string. <str> = str(<Path>) # Returns path as string.
<str> = <Path>.name # Final component. <str> = <Path>.name # Final component.
<str> = <Path>.stem # Final component without extension. <str> = <Path>.stem # Final component without extension.
<str> = <Path>.suffix # Final component's extension. <str> = <Path>.suffix # Final component's extension.
<Path> = <Path>.parent # Path without final component. <Path> = <Path>.parent # Path without final component.
<tuple> = <Path>.parts # All components as strings. <tuple> = <Path>.parts # All components as strings.
``` ```

|||||||
100:0
Loading…
Cancel
Save