pathlib - pretty neat
I was looking at doing a file info thingy to put into the wrench menu. I remembered hearing about the pathlib lib on a video i watched recently. I don't know how long pathlib has been around, but i know they have just updated all the std Libs to work nice with pathlib, i guess they didn't before. Anyway, I don't really know the in's and outs, I started playing with PurePath in the same lib. Well when i say I was playing, I was just printing out some of the methods and attrs. I haven't done them all, but it looks pretty nice if you have to play with paths and files.
Anyway, i just wanted to pass on the info.
import editor from pathlib import Path, PurePath pp = PurePath(editor.get_path()) print(pp.parts) print('drive:', pp.drive) print('root:', pp.root) print('anchor:', pp.anchor) print('parents:', pp.parents) print('parent:', pp.parent) print('name:', pp.name) print('suffix:', pp.suffix) print('suffixes:', pp.suffixes) print('stem:', pp.stem) print('as_posix():', pp.as_posix()) print('as_uri():', pp.as_uri()) print('is_absolute():', pp.is_absolute()) print('is_reserved():', pp.is_reserved())