Differences between revisions 1 and 2
Revision 1 as of 2023-03-01 14:38:24
Size: 1604
Comment:
Revision 2 as of 2023-03-01 14:43:18
Size: 2380
Comment:
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
----

Line 21: Line 24:
----


Line 23: Line 30:
----


Line 25: Line 36:
----


Line 27: Line 42:
----


Line 29: Line 48:
----


Line 31: Line 54:
----


Line 33: Line 60:
----


Line 35: Line 66:
----


Line 37: Line 72:
----


Line 39: Line 78:
----


Line 41: Line 84:
----


Line 43: Line 90:
----


Line 45: Line 96:
----


Line 47: Line 102:
----


Line 49: Line 108:
----


Line 51: Line 114:
----


Line 53: Line 120:
----


Line 55: Line 126:
----


Line 57: Line 132:
----


Line 59: Line 138:
----


Line 61: Line 144:
----


Line 63: Line 150:
----


Line 65: Line 156:
----


Line 67: Line 162:
----


Line 69: Line 168:
----


Line 71: Line 174:
{{{
from pathlib import Path
p = Path('.')

t = p.joinpath('temp')
t.mkdir(parents=False, exist_ok=True)
}}}

----


Line 73: Line 188:
----


Line 75: Line 194:
----


Line 77: Line 200:
----


Line 79: Line 206:
----


Line 81: Line 212:
----


Line 83: Line 218:
----


Line 85: Line 224:
----


Line 87: Line 230:
----


Line 89: Line 236:
----


Line 91: Line 242:
----


Line 93: Line 248:
----


Line 95: Line 254:
----


Line 97: Line 260:
----


Line 99: Line 266:
----


Line 101: Line 272:
----


Line 103: Line 278:
----


Line 105: Line 284:
----


Line 107: Line 290:
----


Line 109: Line 296:
----


Line 111: Line 302:
----


Line 113: Line 308:
----


Line 115: Line 314:
----


Line 117: Line 320:
----


Line 119: Line 326:
----


Line 121: Line 332:
----


Line 123: Line 338:
----


Line 125: Line 344:
----


Line 126: Line 349:

----

Python Pathlib


Path

The Path class is instantiated like:

from pathlib import Path
p = Path('.')


Absolute


Anchor


As_Posix


As_Uri


ChMod


Drive


Exists


ExpandUser


Glob


Group



Is_Absolute


Is_Block_Device


Is_Char_Device


Is_Dir


Is_Fifo


Is_File


Is_Mount


Is_Relative_To


Is_Reserved


Is_Socket



IterDir


JoinPath


Match


MkDir

from pathlib import Path
p = Path('.')

t = p.joinpath('temp')
t.mkdir(parents=False, exist_ok=True)


Name


Open


Owner


Parent


Parents


Parts


Read_Bytes


Read_Text



Relative_To


Rename


Replace


Resolve


RGlob


RmDir


Root


SameFile


Stat


Stem


Suffix


Suffixes



Touch



With_Name


With_Stem


With_Suffix


Write_Bytes


Write_Text


Cwd

A Path class method.

from pathlib import Path
c = Path.cwd()


Home

A Path class method.

from pathlib import Path
h = Path.home()


See also

Python pathlib module documentation


CategoryRicottone

Python/PathLib (last edited 2023-10-11 19:40:58 by DominicRicottone)