Ruby has this really handy module called Pathname .
Is there a python equivalent?
pathlib is the answer to all your paths towards python.
pathlib
Function example:
from pathlib import Path p = Path.cwd() with (p/'somefile.txt').open() as f: f.read() p.is_dir()
This is very similar to os.path .
Source: https://habr.com/ru/post/1767814/More articles:Can I create a user interface using files managed by Alfresco? - apiWhat is it!! and a few more things in Ruby? - ruby โโ| fooobar.comCMS for user application - phpCreating Lists from a Character String - listWhy does this division by zero error occur only in optimized code? - c ++Sort by 2 fields? are there any hacks or with index.yaml? or geoPT? - pythonJava Array - Calculates the average of surrounding numbers - javaQuery if service is running - cEquivalent to pread / pwrite in MSVC? - posixHow to use the Alias โโin Where clause? - sqlAll Articles